|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|3 초||512 MB||78||28||20||32.787%|
We consider strings consisting of lowercase letters of the English alphabet in this problem. An initial fragment of a given string is called its prefix. A final (terminal) fragment of a given string is called its suffix. In particular, the empty string is both a prefix and a suffix of any string. Two strings are cyclically equivalent if one of them can be obtained from another by moving its certain suffix from the end of the string to its beginning. For example, the strings ababba and abbaab are cyclically equivalent, whereas the strings ababba and ababab are not. In particular, every string is cyclically equivalent to itself.
A string t consisting of n letters is given. We are looking for its prefix p and suffix s of equal length such that:
The first line of the standard input contains a single integer n (1 ≤ n ≤ 1,000,000) denoting the length of the string t. The second line of input contains the string t itself, consisting of n lowercase letters of the English alphabet.
Your program should print a single integer in the first and only line of the standard output, namely the common length of the prefix p and the suffix s that we are looking for.