Created
October 23, 2016 18:45
-
-
Save SahilKadam/e0e14a2e256b8e8233d0b1102d5168ed to your computer and use it in GitHub Desktop.
There are strings. Each string's length is no more than characters. There are also queries. For each query, you are given a string, and you need to find out how many times this string occurred previously. Input Format The first line contains , the number of strings. The next lines each contain a string. The nd line contains , the number of queri…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = int(input().strip()) | |
def wordCount(word): | |
global words | |
res = [item for item in words if item == word] | |
return len(res) | |
words = [input().strip() for i in range(N)] | |
N_Q = int(input().strip()) | |
query = [print (wordCount(input().strip())) for i in range(N_Q)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment