#P4780. SP8093 JZPGYZ - Sevenk Love Oimaster

SP8093 JZPGYZ - Sevenk Love Oimaster

SP8093 JZPGYZ - Sevenk Love Oimaster

题目描述

Oimaster and sevenk love each other.
But recently,sevenk heard that a girl named ChuYuXun was dating with oimaster.As a woman's nature, sevenk felt angry and began to check oimaster's online talk with ChuYuXun. Oimaster talked with ChuYuXun n times, and each online talk actually is a string.Sevenk asks q questions like this, "how many strings in oimaster's online talk contain this string as their substrings?"
Input
There are two integers in the first line, the number of strings n and the number of questions q. And n lines follow, each of them is a string describing oimaster's online talk. And q lines follow, each of them is a question.n<=10000, q<=60000 the total length of n strings<=100000, the total length of q question strings<=360000
Output For each question, output the answer in one line. Example

题目大意

给定 n 个模板串,以及 m 个查询串

依次查询每一个查询串是多少个模板串的子串

3 3
abcabcabc
aaa
aafe
abc
a
ca
1
3
1

样例解释

abc在abcabcabc中出现了,所以第一个询问答案为1

a在三个字符串中都出现了,所以第二个询问答案为2

ca只在abcabcabc中出现了,所以第三个询问的答案为3

感谢@KingSann 提供的翻译

输入输出样例 无