{"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":"HTML","content":"\u003cp\u003e\r\n\t\u0026nbsp;\u003c/p\u003e\r\n\u003cp\u003e\r\n\tCurrently , you have solved a string problem , finding the period of a string . But , you thought to rearrange this problem in another way . That is ,for\u0026nbsp;each prefix of a given string \u003cb\u003e\u003ci\u003eS \u003c/i\u003e\u003c/b\u003ewith \u003cb\u003e\u003ci\u003eN \u003c/i\u003e\u003c/b\u003echaracters , you want to know whether the prefix is a periodic string. That is, for each \u003cb\u003e\u003ci\u003ei \u003c/i\u003e\u003c/b\u003e(2 \u0026lt;\u003d \u003cb\u003e\u003ci\u003ei \u003c/i\u003e\u003c/b\u003e \u0026lt;\u003d \u003cb\u003e\u003ci\u003eN\u003c/i\u003e\u003c/b\u003e) we want to know the largest \u003cb\u003e\u003ci\u003eK \u003c/i\u003e\u003c/b\u003e\u0026gt; 1 (if there is one) such that the prefix of \u003cb\u003e\u003ci\u003eS \u003c/i\u003e\u003c/b\u003ewith length \u003cb\u003e\u003ci\u003ei \u003c/i\u003e\u003c/b\u003ecan be written as \u003cb\u003e\u003ci\u003eA\u003c/i\u003e\u003csup\u003e\u003ci\u003eK \u003c/i\u003e\u003c/sup\u003e\u003c/b\u003e, that is \u003cb\u003e\u003ci\u003eA \u003c/i\u003e\u003c/b\u003econcatenated \u003cb\u003e\u003ci\u003eK \u003c/i\u003e\u003c/b\u003etimes, for some string \u003cb\u003e\u003ci\u003eA\u003c/i\u003e\u003c/b\u003e. Of course, we also want to know the period \u003cb\u003e\u003ci\u003eK\u003c/i\u003e\u003c/b\u003e. Each character of string \u003cem\u003e\u003cstrong\u003eS\u003c/strong\u003e\u003c/em\u003e\u0026nbsp;has an ASCII code between 97 and 126, inclusive.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe first line of the input file will contains only the number \u003ci\u003eT (1 \u0026lt;\u003d T \u0026lt;\u003d 10) \u003c/i\u003e of the test cases.\u003c/p\u003e\r\n\u003cp\u003e\r\n\tEach test case consists of two lines. The first one contains \u003cb\u003e\u003ci\u003eN\u003c/i\u003e\u003c/b\u003e (2 \u0026lt;\u003d \u003cb\u003e\u003ci\u003eN\u003c/i\u003e\u003c/b\u003e \u0026lt;\u003d 1 000 000) \u0026ndash; the size of the string \u003cb\u003e\u003ci\u003eS\u003c/i\u003e\u003c/b\u003e. The second line contains the string \u003cb\u003e\u003ci\u003eS\u003c/i\u003e\u003c/b\u003e.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tFor each test case, output \u0026ldquo;Test case #\u0026rdquo; and the consecutive test case number on a single line; then, for each prefix with length \u003cb\u003ei\u003c/b\u003e that has a period \u003cb\u003eK\u003c/b\u003e \u0026gt; 1, output the prefix size \u003cb\u003ei\u003c/b\u003e and the period \u003cb\u003eK\u003c/b\u003e separated by a single space; the prefix sizes must be in increasing order. Print a blank line after each test case.\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003cb\u003eInput:\u003c/b\u003e\r\n2\r\n3\r\naaa\r\n12\r\naabaabaabaab\r\n\r\n\u003cb\u003eOutput:\u003c/b\u003e\r\nTest case #1\r\n2 2\r\n3 3\r\n\r\nTest case #2\r\n2 2\r\n6 2\r\n9 3\r\n12 4\r\n\r\n\u003c/pre\u003e"}}]}