<p style='text-align: justify;'>
A very interesting study indicates that it does not matter the order in which the letters of a word are written as long as the first and last ones are well located.
The brain is capable of identifying them correctly according to the context in which they are used. Nevertheless, a well-written text will help the reader to read faster.
In the following problem, we want to detect, given a set of words whose letters are disordered except for the first and last letter, how many of them can be guaranteed to be written correctly after passing an spell checker. For this purpose, a dictionary with the set of known words and a set of disordered words as described above will be given.
Note that some words, despite not being in the dictionary, can be corrected. In the text "y ese gooooool" all the words can always be corrected even if they are not in the dictionary.
If there are words that can be written in multiple ways according to the dictionary, the spell checker will not be able to correctly identify which one corresponds, so it will not correct them.
</p>
A very interesting study indicates that it does not matter the order in which the letters of a word are written as long as the first and last ones are well located.
The brain is capable of identifying them correctly according to the context in which they are used. Nevertheless, a well-written text will help the reader to read faster.
In the following problem, we want to detect, given a set of words whose letters are disordered except for the first and last letter, how many of them can be guaranteed to be written correctly after passing an spell checker. For this purpose, a dictionary with the set of known words and a set of disordered words as described above will be given.
Note that some words, despite not being in the dictionary, can be corrected. In the text "y ese gooooool" all the words can always be corrected even if they are not in the dictionary.
If there are words that can be written in multiple ways according to the dictionary, the spell checker will not be able to correctly identify which one corresponds, so it will not correct them.
<p style='text-align: justify;'>
The first line will have two integers ($1 \leq N \leq 10000$) indicating the number of words in the dictionary and ($1 \leq M \leq 10000$) indicating the number of words to analyze.
The next $N$ lines will list the $N$ words in the dictionary, followed by the $M$ words to analyze.
All words have at least $1$ character and do not exceed $100$ characters and are composed only of lowercase letters from the English alphabet. **It is not guaranteed that there are no repeated words in the dictionary.**
</p>
The first line will have two integers ($1 \leq N \leq 10000$) indicating the number of words in the dictionary and ($1 \leq M \leq 10000$) indicating the number of words to analyze.
The next $N$ lines will list the $N$ words in the dictionary, followed by the $M$ words to analyze.
All words have at least $1$ character and do not exceed $100$ characters and are composed only of lowercase letters from the English alphabet. It is not guaranteed that there are no repeated words in the dictionary.
An integer with the number of words that will be corrected.
An integer with the number of words that will be corrected.