Javinha is carrying out a research about the popularity of programming languages as homework for a Programming Language course at Fatec. In a web search, he found some statistics on programming languages usage, but none of them satisfied him.
As he is an active participant of a discussion forum on programming language techniques, where programmers from all around the world send their questions and opinions, he decided to use the forum post archive to estimate the popularity of programming languages. The outline of his idea is as follows: the popularity of a specific programming language is equal to the number of posts in which this language is cited at least once.
Despite this simple idea, some problems may arise when searching for a citation in a post. For "C", a search in a post like “as he can write a computer program” may return two false positives: “… Can write … Computer …”. Said that, Javinha decided to consider as a citation only the name of a language with a space before and after it. Also, the search strategy he will adopt won‟t be case sensitive.
As you are very clever, Javinha asked you to write a program that automatically calculates the popularity of languages.
The first line contains an integer P (1 ≤ P ≤ 1000), representing the number of posts in the forum archive. Each of the next P lines contains a post of at most 1000 characters (it can contain any ASCII character). The next line contains an integer N (1 ≤ N ≤ 200), representing the number of programming languages whose popularity should be calculated. Each of the next N lines contains the name of a programming language of at most 30 characters (it can contain any ASCII character).
Output N lines, each one with the name of a programming language and the number of posts in which it was cited (separated by a single space). The languages must be printed in the same order they were informed in the input.
|Exemplos de Entrada||Exemplos de Saída|