Skip to main content
added 650 characters in body
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105

SNOBOL4 (CSNOBOL4), 148148 123 bytes

 S	S =INPUT
N SN	S ARB . L ANY('aeiou') . C REM . S S	:F(O)
	X =1 - X
	C =CHAR(ORD(C) - 32) EQ(X)
	O =O L C	:S(AN)
O	OUTPUT &LCASE=O @PS
END

Try it online!

Explanation:

	S C=INPUT			;* Read input
N	S &UCASEARB LEN(P). LENL ANY(1'aeiou') . C
A REM . S	:F(O)
					;* =OMatch in S:
					;* ARBitrary string (store as L), ANY single vowel (store as C)
					;* Xand the REMainder of the string (store as S).
					;* If there is no match, goto O.
	X =1 - X			;* Set X (initially treated as 0) to 1-X.
	C =CHAR(ORD(C) - 32) EQ(X)	;* if X == 0, set C to uppercase, otherwise do nothing.
	O =O L C	:(N)
 		;* append to O OUTPUTL and C, then goto N.
O	OUTPUT =O SS			;* Output updated string
END

Try it online!

SNOBOL4 (CSNOBOL4), 148 bytes

 S =INPUT
N S ARB . L ANY('aeiou') . C REM . S :F(O)
 EQ(X) :S(A)
 &LCASE @P C
 &UCASE LEN(P) LEN(1) . C
A O =O L C
 X =1 - X :(N)
 O OUTPUT =O S
END

Try it online!

SNOBOL4 (CSNOBOL4), 148 123 bytes

	S =INPUT
N	S ARB . L ANY('aeiou') . C REM . S	:F(O)
	X =1 - X
	C =CHAR(ORD(C) - 32) EQ(X)
	O =O L C	:(N)
O	OUTPUT =O S
END

Try it online!

Explanation:

	S =INPUT			;* Read input
N	S ARB . L ANY('aeiou') . C REM . S	:F(O)
					;* Match in S:
					;* ARBitrary string (store as L), ANY single vowel (store as C)
					;* and the REMainder of the string (store as S).
					;* If there is no match, goto O.
	X =1 - X			;* Set X (initially treated as 0) to 1-X.
	C =CHAR(ORD(C) - 32) EQ(X)	;* if X == 0, set C to uppercase, otherwise do nothing.
	O =O L C	:(N)		;* append to O L and C, then goto N.
O	OUTPUT =O S			;* Output updated string
END
Source Link
Giuseppe
  • 28.8k
  • 3
  • 31
  • 105

SNOBOL4 (CSNOBOL4), 148 bytes

 S =INPUT
N S ARB . L ANY('aeiou') . C REM . S :F(O)
 EQ(X) :S(A)
 &LCASE @P C
 &UCASE LEN(P) LEN(1) . C
A O =O L C
 X =1 - X :(N)
O OUTPUT =O S
END

Try it online!