-
Notifications
You must be signed in to change notification settings - Fork 0
LC 0824 [E] Goat Latin
Code with Senpai edited this page Jan 14, 2022
·
1 revision
class Solution:
def toGoatLatin(self, sentence: str) -> str:
words = sentence.split(' ')
res = []
for i, x in enumerate(words):
s = ''
if x[0].lower() in 'aeiou':
s = x + 'ma'
else:
s = x[1:len(x)] + x[0] + 'ma'
s += 'a' * (i+1)
res.append(s)
return ' '.join(res)
footer