#AG0906001. 统计子串

统计子串

题目名称:统计子串

题目描述

给定一个文本串 ss 以及 qq 个模式串 t1,t2,,tnt_1, t_2, \ldots, t_n

计算 nn 个模式串中有多少个模式串是文本串 ss 的子串。

输入格式

第一行,一个字符串 ss,表示文本串。

第二行,一个整数 qq,表示模式串个数。

接下来 qq 行,每行包含一个模式串 tit_i

输出格式

输出一个整数,表示有多少个模式串是文本串 ss 的子串。

样例

quanjun
5
qua
uanj
qun
uaju
anju
3

说明/提示

数据规模与约定

  • 对于 35%35\% 的数据,s1000,q10,ti10|s| \le 1000, q \le 10, |t_i| \le 10
  • 对于 70%70\% 的数据,s105,q103,ti20|s| \le 10^5, q \le 10^3, |t_i| \le 20
  • 对于 100%100\% 的数据,1s105,1q104,1ti301 \le |s| \le 10^5, 1 \le q \le 10^4, 1 \le |t_i| \le 30,所有的字符串均由小写英文字母构成,且所有的模式串各不相同