{"raw_statement":[{"iden":"statement","content":"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.\n\nYou are given Q queries where each query is of form : \n\nThe 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, .\n\nAn integer for each query of type 1, one on each line.\n\nIn the sample test case \n\n"},{"iden":"input","content":"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, ."},{"iden":"output","content":"An integer for each query of type 1, one on each line."},{"iden":"note","content":"In the sample test case   Query 1: The String is _01010_, Possible palindromic quadruples = _0110_, so answer = 1  Query 2: Update str2 = 0, so the string is now _00010_  Query 3: The String is _00010_, Possible palindromic quadruples = _0000_, so answer = 1  Query 4: Update str4 = 0, so the string is now _00000_  Query 5: The String is _00000_, Possible palindromic quadruples is _0000_ which can be selected in 5 ways, so answer = 5 "}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ S \\in \\{0,1,\\dots,9\\}^n $ be a numeric string of length $ n $.  \nA quadruple $ (x_1, x_2, x_3, x_4) $ is *palindromic* if:  \n$$ x_1 < x_2 < x_3 < x_4 \\quad \\text{and} \\quad S[x_1] = S[x_4] \\quad \\text{and} \\quad S[x_2] = S[x_3] $$\n\n**Constraints**  \n- $ 1 \\leq n \\leq 10^5 $  \n- $ 1 \\leq Q \\leq 10^5 $  \n\n**Operations**  \nFor each query:  \n- Type 1: Given indices $ (x_1, x_2, x_3, x_4) $ with $ x_1 < x_2 < x_3 < x_4 $, output whether $ S[x_1] = S[x_4] $ and $ S[x_2] = S[x_3] $.  \n- Type 2: Update $ S[i] \\leftarrow d $ for some index $ i $ and digit $ d \\in \\{0,1,\\dots,9\\} $.\n\n**Objective**  \nFor each query of type 1, output $ 1 $ if the quadruple is palindromic, otherwise $ 0 $.","simple_statement":"Given a string of digits, count the number of quadruples (i, j, k, l) where i < j < k < l and s[i] == s[l] and s[j] == s[k].","has_page_source":false}