본문 바로가기
python-algorithm

백준 25178 두라무리 휴지

by 무적김두칠 2023. 12. 6.

https://www.acmicpc.net/problem/25178

 

25178번: 두라무리 휴지

기령이는 어느 날 캠릿브지 대학의 연결구과에 대해 알게 되었다. 캠릿브지 대학의 연결구과란, 단어를 이해함에 있어 한 단어 안에서 글자들이 어떤 순서로 배열되어 있는지는 중요하지 않고,

www.acmicpc.net

 

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[0and 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'
 
 
= 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

댓글