Goat Latin
Words in sentence are separated by single spaces. Turn each word into goat latin, using its position i (starting at 1):
- If the word starts with a vowel (
a e i o u, either case), keep it and addmato the end. - Otherwise move the first letter to the end, then add
ma. - Finally add the letter
arepeateditimes to the end.
Return the new words joined by single spaces.
Example 1
sentence "I speak Goat Latin"
returns "Imaa peaksmaaa oatGmaaaa atinLmaaaaa"
Imaa, peaksmaaa, oatGmaaaa, atinLmaaaaa.
Constraints
1 <= len(sentence) <= 100- English letters and single spaces, no space at the start or end
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.