class Solution:
    def toGoatLatin(self, S: str) -> str:
        s = S.split()
        result = ''
        for i, w in enumerate(s):
            if re.match(r'(?i)^[aeiou]', w):
                result += w + 'ma' + (i + 1) * 'a' + ' '
            else:
                result += w[1:] + w[0] + 'ma' + (i + 1) * 'a' + ' '

        return result.strip()
ac6a7425591db5e8089c023cc06420c16140e28c
<mask token>

class Solution:
    <mask token>

class Solution:

    def toGoatLatin(self, S: str) ->str:
        s = S.split()
        result = ''
        for i, w in enumerate(s):
            if re.match('(?i)^[aeiou]', w):
                result += w + 'ma' + (i + 1) * 'a' + ' '
            else:
                result += w[1:] + w[0] + 'ma' + (i + 1) * 'a' + ' '
        return result.strip()

class Solution:
    def toGoatLatin(self, S: str) -> str:
        s = S.split()
        result = ''
        for i, w in enumerate(s):
            if re.match(r'(?i)^[aeiou]', w):
                result += w + 'ma' + (i + 1) * 'a' + ' '
            else:
                result += w[1:] + w[0] + 'ma' + (i + 1) * 'a' + ' '

        return result.strip()