SP10079 STAMMER - Stammering Aliens
Description
Dr. Ellie Arroway has established contact with an extraterrestrial civilization. However, all efforts to decode their messages have failed so far because, as luck would have it, they have stumbled upon a race of stuttering aliens! Her team has found out that, in every long enough message, the most important words appear repeated a certain number of times as a sequence of consecutive characters, even in the middle of other words. Furthermore, sometimes they use contractions in an obscure manner. For example, if they need to say _bab_ twice, they might just send the message _babab_, which has been abbreviated because the second _b_ of the first word can be reused as the first _b_ of the second one.
Thus, the message contains possibly overlapping repetitions of the same words over and over again. As a result, Ellie turns to you, S.R. Hadden, for help in identifying the gist of the message.
Given an integer _m_, and a string _s_, representing the message, your task is to find the longest substring of _s_ that appears at least _m_ times. For example, in the message _baaaababababbababbab_, the length-5 word _babab_ is contained 3 times, namely at positions 5, 7 and 12 (where indices start at zero). No substring appearing 3 or more times is longer (see the first example from the sample input). On the other hand, no substring appears 11 times or more (see example 2).
In case there are several solutions, the substring with the rightmost occurrence is preferred (see example 3).
**Input**
The input contains several test cases. Each test case consists of a line with an integer _m_ (_m_ >= 1), the minimum number of repetitions, followed by a line containing a string _s_ of length between _m_ and 40 000, inclusive. All characters in _s_ are lowercase characters from “a” to “z”. The last test case is denoted by _m_ = 0 and must not be processed.
**Output**
Print one line of output for each test case. If there is no solution, output none; otherwise, print two integers in a line, separated by a space. The first integer denotes the maximum length of a substring appearing at least _m_ times; the second integer gives the rightmost possible starting position of such a substring.
**Sample Input**
```
3
baaaababababbababbab
11
baaaababababbababbab
3
cccccc
0
```
Input Format
N/A
Output Format
N/A