You are viewing a single comment's thread. Return to all comments →
n = int(input())
dic = {}
for _ in range(n): word = input() if word in dic.keys(): dic[word]+=1 else: dic[word] = 1
print(len(dic.keys()))
occ = [str(i) for i in dic.values()]
print(' '.join(occ))
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 →
n = int(input())
dic = {}
for _ in range(n): word = input() if word in dic.keys(): dic[word]+=1 else: dic[word] = 1
print(len(dic.keys()))
occ = [str(i) for i in dic.values()]
print(' '.join(occ))