Skip to main content
added 351 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 77 bytes with input as string (for comparison to Maël's answer).


Edit: this approach would be only 48 bytes by porting dingledooper's great modulo trick...

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 77 bytes with input as string (for comparison to Maël's answer).

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 77 bytes with input as string (for comparison to Maël's answer).


Edit: this approach would be only 48 bytes by porting dingledooper's great modulo trick...

deleted 1 character in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 72 bytes77 bytes with input as string (for comparison to Maël's answer).

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 72 bytes with input as string (for comparison to Maël's answer).

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 77 bytes with input as string (for comparison to Maël's answer).

Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 57 bytes

function(s,t=s%in%utf8ToInt("aeiou"))s-t*32*!cumsum(t)%%2

Try it online!

Input is vector of character codes (for comparison to pajonk's answer). Would be 72 bytes with input as string (for comparison to Maël's answer).