f | import re | f | import re |
| | | |
| | | |
| def translate(word): | | def translate(word): |
| d = re.findall(r'[-/:`(),.!?;"\[\]\d+*{}\\_=]', word) | | d = re.findall(r'[-/:`(),.!?;"\[\]\d+*{}\\_=]', word) |
| k = '' if len(d) == 0 else d[0] | | k = '' if len(d) == 0 else d[0] |
| if k != '': | | if k != '': |
| return k.join(map(lambda a: translate(a), word.split(k))) | | return k.join(map(lambda a: translate(a), word.split(k))) |
t | | t | |
| # if re.match(r'^[0-9]+\D', word): | | |
| # num = re.findall('^[0-9]+', word)[0] | | |
| # return num.join(map(lambda a: translate(a), word.split(num))) | | |
| | | |
| capital = bool(re.match('^[A-Z]', word)) | | capital = bool(re.match('^[A-Z]', word)) |
| if len(re.findall('[aoieuAOIEU]', word)) == 0: | | if len(re.findall('[aoieuAOIEU]', word)) == 0: |
| return word | | return word |
| elif len(re.findall('[aoieuAOIEU]', word)) == 1 and re.match('^[aoieuAOIEU]', word): | | elif len(re.findall('[aoieuAOIEU]', word)) == 1 and re.match('^[aoieuAOIEU]', word): |
| return word + 'yay' | | return word + 'yay' |
| elif re.match('^[^aoieuAOIEU]', word) or re.match('^[aouieAOIEU]', word): | | elif re.match('^[^aoieuAOIEU]', word) or re.match('^[aouieAOIEU]', word): |
| if re.match('^[^aoieuAOIEU]', word): | | if re.match('^[^aoieuAOIEU]', word): |
| sp = re.split('(^[^aouieAOIEU]+)', word) | | sp = re.split('(^[^aouieAOIEU]+)', word) |
| elif re.match('^[aouieAOIEU][aouie]', word): | | elif re.match('^[aouieAOIEU][aouie]', word): |
| sp = re.split('(^[aouieAOIEU])', word) | | sp = re.split('(^[aouieAOIEU])', word) |
| else: | | else: |
| sp = re.split('(^[aouieAOIEU]+[^aouieAOIEU]+)', word) | | sp = re.split('(^[aouieAOIEU]+[^aouieAOIEU]+)', word) |
| if capital: | | if capital: |
| sp[2] = sp[2][0].upper() + sp[2][1:] | | sp[2] = sp[2][0].upper() + sp[2][1:] |
| return ''.join([sp[2], sp[1].lower(), 'ay']) | | return ''.join([sp[2], sp[1].lower(), 'ay']) |
| else: | | else: |
| return ''.join([sp[2], sp[1], 'ay']) | | return ''.join([sp[2], sp[1], 'ay']) |
| | | |
| | | |
| s = input() | | s = input() |
| res = [] | | res = [] |
| while s != '': | | while s != '': |
| res.append(' '.join(map(lambda w: translate(w), s.split(' ')))) | | res.append(' '.join(map(lambda w: translate(w), s.split(' ')))) |
| s = input() | | s = input() |
| | | |
| for w in res: | | for w in res: |
| print(w) | | print(w) |
| | | |