#P8306. Prefix Query Count
Prefix Query Count
Prefix Query Count
Given pattern strings and queries, each query provides a text string . For each query, count the number of strings among for which is a prefix.
A string is a prefix of a string if and only if after deleting some (possibly zero) characters from the end of , the string becomes . The input is case sensitive.
inputFormat
The first line contains an integer , the number of pattern strings.
The following lines each contain a non-empty pattern string.
The next line contains an integer , the number of queries.
The next lines each contain a query string .
outputFormat
For each query, output on a new line the count of pattern strings that have the query string as a prefix.
sample
5
apple
application
apricot
banana
band
3
app
ban
z
2
2
0
</p>