text: words of English letters (lowercase and uppercase) separated by single spaces. Each word is encoded like this:
1. If the word starts with a vowel (a, e, i, o, u in either case), it stays as it is. Otherwise its first letter moves to the end of the word.
2. ma is appended to the word.
3. Then letters a are appended, as many as the word's position in the phrase counting from 1: one for the first word, two for the second, and so on.
Return the encoded phrase, with the words separated by single spaces.text='Every cat likes milk' → 'Everymaa atcmaaa ikeslmaaaa ilkmmaaaaa'
Every starts with a vowel and gets ma + a; cat moves its first letter to the end: atc + ma + aa; then ikesl + ma + aaa and ilkm + ma + aaaa.
text='Up we go' → 'Upmaa ewmaaa ogmaaaa'
A capital U is a vowel too, so Up keeps its letters in place.
text='x' → 'xmaa'
text consists of English letters and spacestext='Every cat likes milk'
'Everymaa atcmaaa ikeslmaaaa ilkmmaaaaa'
Run checks the first 3 tests in your browser. Submit checks all 138 tests on the server, hidden ones included.