Skip to main content
3 of 3
added 351 characters in body
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...

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