You are viewing a single comment's thread. Return to all comments →
I haven't checked in python2 - but in 3 you don't need defaultdict if you use Counter.
from collections import Counter, defaultdict cnt = Counter([input().strip() for _ in range(int(input().strip()))]) for _ in range(int(input().strip())): print(cnt[input().strip()])
Seems like cookies are disabled on this browser, please enable them to open this website
Sparse Arrays
You are viewing a single comment's thread. Return to all comments →
I haven't checked in python2 - but in 3 you don't need defaultdict if you use Counter.