#abc362g. G - Count Substring Query
G - Count Substring Query
Score : points
问题陈述
你得到了一个由小写英文字母组成的字符串 。
你还需要依次处理 个查询。第 个查询描述如下:
- 给定一个由小写英文字母组成的字符串 。打印出 中等于 的子字符串的数量。如果两个子字符串来自不同的位置,即使它们作为字符串相等,也被认为是不同的。
 
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given a string consisting of lowercase English letters.
You are also given queries to process sequentially. The -th query is described as follows:
- A string consisting of lowercase English letters is given. Print the number of substrings of that equal . Two substrings are distinguished if they are taken from different positions, even if they are equal as strings.
 
Constraints
- $\displaystyle \sum_{i=1}^Q |T_i| \leq 5 \times 10^5$
 - and are strings consisting of lowercase English letters.
 - is an integer.
 
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to the -th query.
Sample Input 1
missisippi
5
i
s
a
is
missisippi
Sample Output 1
4
3
0
2
1
Let denote the substring of from the -th character through the -th character.
- For the 1st query, four substrings of  equal 
i: . - For the 2nd query, three substrings of  equal 
s: . - For the 3rd query, no substrings of  match 
a. - For the 4th query, two substrings of  equal 
is: . - For the 5th query, one substring of  equals 
missisippi: . 
Sample Input 2
aaaaaa
6
a
aa
aaa
aaaa
aaaaa
aaaaaa
Sample Output 2
6
5
4
3
2
1