{"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\nA string s is called an (k,l)-repeat if s is obtained by concatenating k\u0026gt;\u003d1 times some seed string t with length l\u0026gt;\u003d1. For example, the string \r\n\u003c/p\u003e\u003cp\u003e\r\ns \u003d abaabaabaaba\r\n\u003c/p\u003e\u003cp\u003e\r\nis a (4,3)-repeat with t \u003d aba as its seed string. That is, the seed string t is 3 characters long, and the whole string s is obtained by repeating t 4 times. \u003c/p\u003e\u003cp\u003e\r\nWrite a program for the following task: Your program is given a long string u consisting of characters ‘a’ and/or ‘b’ as input. Your program must find some (k,l)-repeat that occurs as substring within u with k as large as possible. For example, the input string\r\n\u003c/p\u003e\u003cp\u003e\r\nu \u003d babb\u003cu\u003eabaabaabaaba\u003c/u\u003eb\r\n\u003c/p\u003e\u003cp\u003e\r\ncontains the underlined (4,3)-repeat s starting at position 5. Since u contains no other contiguous substring with more than 4 repeats, your program must output the maximum k. \r\n\u003c/p\u003e\u003cp\u003e\r\n\r\n\r\n\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\r\nIn the first line of the input contains H- the number of test cases (H \u0026lt;\u003d 20). H test cases follow. First line of each test cases is n - length of the input string (n \u0026lt;\u003d 50000), The next n lines contain the input string, one character (either ‘a’ or ‘b’) per line, in order. \r\n\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003e\r\nFor each test cases, you should write exactly one interger k in a line - the repeat count that is maximized. \r\n\u003c/p\u003e\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\u003e1\r\n17\r\nb\r\na\r\nb\r\nb\r\na\r\nb\r\na\r\na\r\nb\r\na\r\na\r\nb\r\na\r\na\r\nb\r\na\r\nb\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\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\r\nsince a (4, 3)-repeat is found starting at the 5th character of the input string.\r\n\n\u003c/div\u003e"}}]}