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 fox
Output:eThemaa ickqumaaa ownbrmaaa oxfmaaaaa
Explanation:

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

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!