하루일문
[백준] 1302번 베스트셀러 (파이썬) 본문
풀이
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() = 튜플로 묶어 준다
'algorithm > baekjoon' 카테고리의 다른 글
[백준] 1822번 차집합 (파이썬) (0) | 2023.02.15 |
---|---|
[백준] 20291번 파일 정리 (파이썬) (1) | 2023.02.15 |
[백준] 14227번 소트인사이드 (파이썬) (0) | 2023.02.14 |
[백준] 10816번 숫자 카드 2(파이썬) (1) | 2023.02.14 |
[백준] 4963 섬의 개수(파이썬) (0) | 2023.02.13 |