본문 바로가기
python-algorithm

[백준] 6996

by 무적김두칠 2021. 1. 25.

1
2
3
4
5
6
7
for _ in range(int(input())):
    a,b=input().split()
    tmpa,tmpb=[0]*26,[0]*26
    for i in a: tmpa[ord(i)-97]+=1
    for i in b: tmpb[ord(i) - 97+= 1
    if tmpa==tmpb: print("%s & %s are anagrams."%(a,b))
    elseprint("%s & %s are NOT anagrams."%(a,b))
cs

저는 문자열을 입력받아서 알파벳 개수를 이용해서 문제를 해결했습니다.

반응형

'python-algorithm' 카테고리의 다른 글

[백준] 8974  (0) 2021.01.25
[백준] 8595  (0) 2021.01.25
[백준] 1010  (0) 2021.01.21
[백준] 11719  (0) 2021.01.21
[백준] 11050  (0) 2021.01.21

댓글