{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"MD","content":"给定字符串 S,要求支持三种操作:\n* ``R i c`` \n把第 i 个字符替换为 c;\n* ``I i c``\n在第 i 个字符后面增加 c;\n* ``Q i j``\n询问后缀串 i 和后缀串 j 的最长公共前缀;\n\n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cp\u003eThe first line will be number of test cases T.\u003cbr\u003e The first line of each test case is a string S with length L (1 \u0026lt;\u003d L \u0026lt;\u003d 100000).\u003cbr\u003e The second line contains an integer Q(1 \u0026lt;\u003d Q \u0026lt;\u003d 150000), representing the number of operations.\u003cbr\u003e\u003cbr\u003e Each of the following Q lines represents an operation:\u003cbr\u003e Q i j: print LCP(S[i..L], S[j..L])\u003cbr\u003e R i char: replace the i-th character of S with char\u003cbr\u003e I i char: insert character char after the i-th character of S\u003cbr\u003e \u003c/p\u003e\n \u003ch3\u003eOutput\u003c/h3\u003e \n \u003cp\u003eFor each \"Q i j\" operation, print the answer. \u003c/p\u003e\n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n1\nmadamimadam\n7\nQ 1 7\nQ 4 8\nQ 10 11\nR 3 a\nQ 1 7\nI 10 a\nQ 2 11\n\n\u003cb\u003eOutput:\u003c/b\u003e\n5\n1\n0\n2\n1\n\u003c/pre\u003e \n\u003c/div\u003e"}}]}