Problem F: String Search - Multiple String Matching

"
Time Limit $3$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $28$ 正确数量 $17$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL 字符串

String Search 

Determine whether a text T includes a pattern P. Your program should answer for given queries consisting of Pi.

In the first line, a text T is given. In the second line, an integer Q denoting the number of queries is given. 

In the following Q lines, the patterns Pi are given respectively.

For each question, print 1 if the text includes Pi, or print 0 otherwise.
aabaaa
4
aa
ba
bb
xyz
1
1
0
0

1 ≤ length of T ≤ 1000000 

1 ≤ length of Pi ≤ 1000 

1 ≤ Q ≤ 10000 

The input consists of alphabetical characters and digits