{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eヴィクターは糸で遊ぶのが大好きです。彼は文字列が回文文字列であると魅力的だと考えています。\u003cbr\u003e\u003cbr\u003eヴィクターは$n$回遊びたいと思っています。各回、以下の4つの操作のうちの1つを行います。\u003cbr\u003e\u003cbr\u003e操作1:文字列の先頭に文字$c$を追加します。\u003cbr\u003e\u003cbr\u003e操作2:文字列の末尾に文字$c$を追加します。\u003cbr\u003e\u003cbr\u003e操作3:異なる魅力的な部分文字列の数を尋ねます。\u003cbr\u003e\u003cbr\u003e操作4:異なる位置で始まる同じ部分文字列の数を尋ねます。\u003cbr\u003e\u003cbr\u003e最初、ヴィクターは空の文字列を持っています。\u003c/div\u003e"}},{"title":"入力","value":{"format":"HTML","content":"入力には複数のテストケースが含まれ、最大$5$個のケースがあります。\u003cbr\u003e\u003cbr\u003e各ケースでは、最初の行に操作の回数を表す整数$n$があります。\u003cbr\u003e\u003cbr\u003e次の$n$行の最初の数字は操作の種類を表す整数$op$です。もし$op$\u003d$1$または$2$であれば、それに続いて小文字の英字が続きます。\u003cbr\u003e\u003cbr\u003e$1\\leq n \\leq 100000$。"}},{"title":"出力","value":{"format":"HTML","content":"各クエリ操作(操作3または4)に対して、正しい答えを出力してください。"}},{"title":"サンプル","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n1 a\r\n1 b\r\n2 a\r\n2 c\r\n3\r\n4\r\n8\r\n1 a\r\n2 a\r\n2 a\r\n1 a\r\n3\r\n1 b\r\n3\r\n4\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n5\r\n4\r\n5\r\n11\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}