단어 정렬

last update: 2021.09.08.WED

1181 단어 정렬, Silver 5

Memory 36552KB, Time 132ms


import sys
n = int(input())
words = [sys.stdin.readline().strip() for _ in range(n)]
words = set(words)
result = sorted(words, key= lambda x: (len(x), x))

print('\n'.join(result))