Description
Convert a sentence to Goat Latin: words starting with vowels add "ma", others move first letter to end + "ma", then add "a" repeated by word index.
Examples
Input:
sentence = "I speak Goat Latin"Output:
"Imaa speakmaa oatGmaaa atinLmaaaa"Explanation:
Goat Latin conversion.
Input:
sentence = "a"Output:
"Imaa speakmaa oatGmaaa atinLmaaaa"Explanation:
A single-word sentence is converted to Goat Latin by applying the vowel/consonant rule and appending 'a' characters.
Input:
The quick brown foxOutput:
eThemaa ickqumaaa ownbrmaaa oxfmaaaaaExplanation:
Each word is converted to Goat Latin: consonant-starting words move the first consonant to the end and add 'ma' plus 'a's equal to the word position, while vowel-starting words just add 'ma' plus the position-based 'a's.
Constraints
- •
1 ≤ sentence.length ≤ 150