{"raw_statement":[{"iden":"statement","content":"This is the most direct problem ever, you are required to implement some basic string operations like insert and substring.\n\nIn this problem |*S*| means the length of the string *S*.\n\n_Note: We didn't find a good name for this problem._\n\nThe input starts with a line containing a string *S* (1  ≤  |*S*|  ≤  200,000), followed by one or more lines each describing one of the following operations to perform on *S* (all indices are zero based, and the quotes are for clarity):\n\nStrings *S* and *R* will consist of lower case English letters only ('a' to 'z'), and |*S*| will never get greater than 200,000 as a result of the operations. Also, the total number of characters to be printed will not exceed 200,000.\n\nFor every \"P *X* *Y*\" operation in the input, print one line with the corresponding substring.\n\n"},{"iden":"input","content":"The input starts with a line containing a string *S* (1  ≤  |*S*|  ≤  200,000), followed by one or more lines each describing one of the following operations to perform on *S* (all indices are zero based, and the quotes are for clarity):  \"I *R* *X*\" means insert the string *R* (1  ≤  |*R*|  ≤  200,000) in *S* at index *X* (0  ≤  *X*  ≤  |*S*|), when *X* equals |*S*| this means append *R* at the end of *S*. For example, the result of inserting \"xy\" in \"abc\" at position 1 will be \"axybc\", and the result of inserting \"xy\" in \"abc\" at position 3 will be \"abcxy\", and the result of inserting \"xy\" in \"abc\" at position 0 will be \"xyabc\".  \"P *X* *Y*\" means print the substring of *S* from *X* to *Y*, inclusive (0  ≤  *X*  ≤  *Y* < |*S*|). For example the substring from 0 to 2 of \"abc\" is \"abc\", and the string from 1 to 1 of \"abc\" is \"b\".  \"END\" Indicates the end of operations, and will be last line of the input. Strings *S* and *R* will consist of lower case English letters only ('a' to 'z'), and |*S*| will never get greater than 200,000 as a result of the operations. Also, the total number of characters to be printed will not exceed 200,000."},{"iden":"output","content":"For every \"P *X* *Y*\" operation in the input, print one line with the corresponding substring."},{"iden":"examples","content":"InputacmI ac 3P 0 3I x 3I xxxx 6I pc 6P 0 11ENDOutputacmaacmxacpcxxxx"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ S \\in \\Sigma^* $ be the initial string, where $ \\Sigma = \\{a, b, \\dots, z\\} $ and $ 1 \\leq |S| \\leq 200{,}000 $.  \nLet $ \\mathcal{O} $ be a sequence of operations of the form:  \n- $ \\texttt{I } X \\ Y \\ R $: Insert string $ R $ into $ S $ at index $ X $, replacing the substring starting at $ X $ of length $ Y $.  \n- $ \\texttt{P } X \\ Y $: Print the substring $ S[X : X+Y] $ (i.e., from index $ X $ inclusive to $ X+Y $ exclusive).  \n\n**Constraints**  \n1. $ |S| \\leq 200{,}000 $ at all times.  \n2. All indices $ X, Y $ satisfy $ 0 \\leq X \\leq |S| $, $ 0 \\leq Y \\leq |S| - X $.  \n3. $ R \\in \\Sigma^* $, and $ |R| \\geq 0 $.  \n4. Total characters printed across all \"P\" operations $ \\leq 200{,}000 $.  \n\n**Objective**  \nFor each operation $ \\texttt{P } X \\ Y $, output the substring $ S[X : X+Y] $.  \nFor each operation $ \\texttt{I } X \\ Y \\ R $, update $ S \\leftarrow S[0:X] + R + S[X+Y:] $.","simple_statement":"Given a string S, perform operations: insert a string R at position X, or print substring from X to Y.","has_page_source":false}