This solution uses a 125-char string, where the lowercase letters serve as delimiters and the first letter of the following sequence of capital letters.
We iterate over the letters of $L
. If the current letter $X
is lowercase by ascii comparison, set $W
to $X
. Otherwise, print $W
concatenated with $X
to make the current word.
[Try it Online!][1]
L=aABDEGHILMNRSTWXYbAEIOYdEOeDFHLMNRSTXfAEgOhAEIMOiDFNSTjOkAIlAIOmAEIMOUYnAEOUoDEFHIMNPRSWXYpAEIqIrEsHIOtAIOuHMNPSTwEOxIUyAEOzA