[알고리즘/백준] 20291번 : 파일 정리(python)

유현민·2022년 7월 20일
0

알고리즘

목록 보기
221/253

(.)으로 나눠주고 딕셔너리로 갯수를 세어준다.

import sys
from collections import defaultdict

input = sys.stdin.readline
dic = defaultdict(int)
for _ in range(int(input())):
    name, extension = input().strip().split('.')
    dic[extension] += 1
for key, value in dict(sorted(dic.items())).items():
    print(key, value)
profile
smilegate megaport infra

0개의 댓글