https://www.acmicpc.net/problem/25178
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | def sol(s1, s2): def first(s1, s2): if sorted(s1) == sorted(s2): return True else: return False def second(s1, s2): if s1[0] == s2[0] and s1[-1] == s2[-1]: return True else: return False def third(s1, s2): new_s1 = new_s2 = '' vowel = 'aeiou' for i in s1: if i not in vowel: new_s1 += i for i in s2: if i not in vowel: new_s2 += i if new_s1 == new_s2: return True else: return False if first(s1, s2) and second(s1, s2) and third(s1, s2): return 'YES' else: return 'NO' n = int(input()) s1 = input() s2 = input() print(sol(s1, s2)) | cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 30468 호반우가 학교에 지각한 이유 1 (0) | 2023.12.20 |
---|---|
백준 1120 문자열 (1) | 2023.12.06 |
백준 20114 미아 노트 (1) | 2023.12.06 |
백준 17091 단어 시계 (0) | 2023.12.06 |
백준 9324 진짜 메시지 (1) | 2023.12.06 |
댓글