You are viewing a single comment's thread. Return to all comments →
Here's my codes.
using native:
res = {} for i in range(int(input())): u = input() if u in res: res[u] += 1 continue res[u] = 1 print(len(res.keys())) print(*res.values())
with Counter func:
from collections import Counter res = Counter(input() for _ in range(int(input()))) print(len(res.keys())) print(*res.values())
Seems like cookies are disabled on this browser, please enable them to open this website
Word Order
You are viewing a single comment's thread. Return to all comments →
Here's my codes.
using native:
with Counter func: