Determine whether a text T includes a pattern P. Your program should answer for given…
- User
Determine whether a text T includes a pattern P. Your program should answer for given queries consisting of P_i.
Constraints
- 1 ≤ length of T ≤ 1000000
- 1 ≤ length of P_i ≤ 1000
- 1 ≤ Q ≤ 10000
- The input consists of alphabetical characters and digits
Input
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 P_i are given respectively.
Output
For each question, print 1 if the text includes P_i, or print 0 otherwise.
Example
Input
aabaaa 4 aa ba bb xyz
Output
1 1 0 0
Assistant
python
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.