On a cyclic tape, lowercase Latin letters are written. For a role-playing game, you need to cut out at least identical words. The longer the word, the more interesting the game will be. Find the length of the longest word that can be cut out at least times.
The input consists of multiple test cases. Each line contains a single test case: the integer and a non-empty string—the letters written on the tape. The input ends at the end of the file. The total number of letters on all tapes in all test cases does not exceed 10^5. All numbers in the input are positive integers not exceeding 10^5.
For each test case, output the answer to the problem—the length of the longest word.
Example 1