하루일문

[백준] 1302번 베스트셀러 (파이썬) 본문

algorithm/baekjoon

[백준] 1302번 베스트셀러 (파이썬)

support_u 2023. 2. 14. 17:56

풀이

import sys
n = int(sys.stdin.readline())
book_li = []

for _ in range(n):
    book = sys.stdin.readline().strip()
    book_li.append(book)

# 먼저 사전 순으로 정렬
book_li = sorted(book_li)

from collections import Counter
count = Counter(book_li).most_common()
print(count[0][0])

most_common() = 튜플로 묶어 준다