From 3875ce7c32da70f0f231c7c6456b820ebedb5342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C5=9F=C4=B1nsu=20Ar=C4=B1c=C4=B1?= Date: Sat, 12 Mar 2022 23:52:08 +0300 Subject: [PATCH] 824 --- E_824_GoatLatin.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 E_824_GoatLatin.py diff --git a/E_824_GoatLatin.py b/E_824_GoatLatin.py new file mode 100644 index 0000000..99d402e --- /dev/null +++ b/E_824_GoatLatin.py @@ -0,0 +1,13 @@ +class Solution: + def toGoatLatin(self, sentence: str) -> str: + tokens=sentence.split() + + for token in tokens: + if token[0] in 'AEIOUaeiou': + tokens[tokens.index(token)]=token+"ma"+(tokens.index(token)+1)*"a" + + else: + tokens[tokens.index(token)]=token[1:]+token[0]+"ma"+(tokens.index(token)+1)*"a" + + return ' '.join(tokens) + \ No newline at end of file