You are viewing a single comment's thread. Return to all comments →
from collections import Counter n=int(input()) # no of words 4 ls=[] for i in range(n): w=input() ls.append(w)
ls=Counter(ls) print(len(ls.keys())) for i in ls.values(): print(i,end=' ')
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 →
using counter
from collections import Counter n=int(input()) # no of words 4 ls=[] for i in range(n): w=input() ls.append(w)
ls=Counter(ls) print(len(ls.keys())) for i in ls.values(): print(i,end=' ')