Write a program or a function that will output a given string in a staircase fashion, writing each part of a word that starts with a vowel one line below the previous part.
Input: Programming Puzzles and Code Golf Output: Pr P C G ogr uzzl and od olf amm es e ing
A string containing nothing but letters and spaces.
The string can be passed via
STDIN or function arguments or anything equivalent.
Letters can be lowercase or uppercase.
Inputs are always assumed to follow those rules, you don't need to check for incorrect inputs.
Each time a vowel (that is,
y) is encountered in a word, you must output the rest of the word on the next line (the encountered vowel included), at the correct horizontal position. This rule is recursive, which means that if there are n vowels in the word, it will be written on n+1 lines.
The vowel should be written at the beginning of the next line, and not at the end of the previous line when one is encountered.
Each word starts on the first line, and should thus be formatted independently from other words. Two words are separated by a space.
If a word starts with a vowel, you have to write it starting on the second line.
Programming Puzzles and Code Golf
Pr P C G ogr uzzl and od olf amm es e ing
The quick brown fox jumps over the lazy dog
Th q br f j th l d e u own ox umps ov e az og ick er y
a e i o u y
YEAh UppErcAsE VOwEls
V Y Upp Ow E Erc Els Ah As E
If you only knew the power of the Dark Side
kn th p th D S If y onl ew e ow of e ark id o y er e u
This is code-golf, so the shortest code wins.