Procon 2016 |
---|
Finished |
Consider a numeric string str where stri denotes the digit(0 to 9) at index i. We call (x1, x2, x3, x4) quadruple a palindromic quadruple of string S if it satisfies the following criteria : Sx1 = Sx4 and Sx2 = Sx3 where x1 < x2 < x3 < x4.
You are given Q queries where each query is of form :
The first line contains a string str, such that , and . The second line contains a single integer, Q(1 ≤ Q ≤ 105), the number of queries. Each of the next Q lines contains a query, with format as described in the problem statement. In queries of type 2, .
An integer for each query of type 1, one on each line.
01010
5
1 1 5
2 2 0
1 1 5
2 4 0
1 1 5
1
1
5
In the sample test case
Name |
---|