{"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":"\u003cdiv id\u003d\"problem-body\"\u003e \n \u003cp\u003e A 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 \u003c/p\u003e\n \u003cp\u003e s \u003d abaabaabaaba \u003c/p\u003e\n \u003cp\u003e is 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\n \u003cp\u003e Write 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 \u003c/p\u003e\n \u003cp\u003e u \u003d babb\u003cu\u003eabaabaabaaba\u003c/u\u003eb \u003c/p\u003e\n \u003cp\u003e contains 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. \u003c/p\u003e\n给定一个字符串,求重复次数最多的连续重复子串的重复次数\n \u003cp\u003e \u003c/p\u003e\n \u003ch3\u003eInput\u003c/h3\u003e \n \u003cp\u003e In 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. \u003c/p\u003e\n \u003ch3\u003eOutput\u003c/h3\u003e \n \u003cp\u003e For each test cases, you should write exactly one interger k in a line - the repeat count that is maximized. \u003c/p\u003e\n \u003ch3\u003eExample\u003c/h3\u003e \n \u003cpre\u003e\n\u003cb\u003eInput:\u003c/b\u003e\n1\n17\nb\na\nb\nb\na\nb\na\na\nb\na\na\nb\na\na\nb\na\nb\n\n\u003cb\u003eOutput:\u003c/b\u003e\n4\n\u003c/pre\u003e since a (4, 3)-repeat is found starting at the 5th character of the input string. \n\u003c/div\u003e"}}]}