You are given a sentence consisting of words separated by spaces.
Your task is to transform the sentence into Goat Latin, a playful language transformation defined by the following rules:
1. If a word begins with a vowel (a, e, i, o, u, case-insensitive), append "ma" to the end of the word.
o Example: "apple" → "applema"
2. If a word begins with a consonant, remove its first letter, move it to the end, and then append "ma".
o Example: "goat" → "oatgma"
3. For each word, add an increasing number of 'a' characters to the end of the word — one 'a' for the first word, two 'a's for the second, and so on.
Finally, return the transformed sentence after applying all the above rules.
Input: sentence = "Amazing elephants run fast"
Output: "Amazingmaa elephantsmaaa unrmaaaa astfmaaaaa"
Input: sentence = "We love Python programming"
Output: "eWmaa ovelmaaa ythonPmaaaa rogrammingpmaaaaa"
Accepted:
Submission: