백준 25099번: Anagram #Python

ColorlessDia·2025년 5월 9일

algorithm/baekjoon

목록 보기
537/807
import sys

input = sys.stdin.readline

N = int(input())

anagram_history = dict()

for _ in range(N):
    word = input().rstrip()
    sorted_word = ''.join(sorted(word))

    if sorted_word in anagram_history:
        continue
    
    anagram_history[sorted_word] = 1
    
    print(word)

0개의 댓글