You are viewing a single comment's thread. Return to all comments →
2 lines in python does the work.
s=[input() for s in range(int(input()))]
[print(s.count(input())) for j in range(int(input()))]
first line stores the inputs in a list.
second line counts the occurances of present input in the previous list.