#00015B

z-which

You are given 1 <= n <= 200 different strings. Each string has up to 500 characters. You are also given a text with m words (strings). The text consist only of the n given strings. You have to find out how many times each of the n strings appear in the text


InputFrom the first line of the standard input read two integers n and m, where 1 <= n <= 200 and 1 <= m <= 2000. From the second line read n strings, and finally from the third line read the text (m strings). All the strings are separated by a space character, and the strings contain letters of the english alphabet plus numbers.

OutputTo the standard output, write n lines. In each of the n lines write one integer representing the number of times the corresponding word (string) occurs in the text. The sum of all n lines will equal to m, since all the words in the text are one of the n given words

Input:
2 5
A B
A B A B A

Output:
3
2

Input:
5 5
A B C AA BB
AA AA AA AA C

Output:
0
0
1
4
0

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.