{"trustable":true,"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":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003e\r\nFor 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 (each character has an ASCII code between 97 and 126, inclusive), we 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.\r\n\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\r\nThe first line of the input file will\r\ncontains only the number \u003ci\u003eT (1 \u0026lt;\u003d T \u0026lt;\u003d 10) \u003c/i\u003e of the test cases.\r\n\u003c/p\u003e\r\n\u003cp\u003e\r\nEach test case consists of two\r\nlines. 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) – the size of the string \u003cb\u003e\u003ci\u003eS\u003c/i\u003e\u003c/b\u003e.\r\nThe second line contains the string \u003cb\u003e\u003ci\u003eS\u003c/i\u003e\u003c/b\u003e.\r\n\u003c/p\u003e\r\n\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003e\r\nFor each test case, output “Test case #” and the consecutive test case\r\nnumber 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\r\nprefix sizes must be in increasing order. Print a blank line after each test case.\r\n\u003c/p\u003e\r\n\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e2\r\n3\r\naaa\r\n12\r\naabaabaabaab\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eTest 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\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\n\u003c/div\u003e"}}]}