#P4391. [BalticOI 2009] Radio Transmission 无线传输

[BalticOI 2009] Radio Transmission 无线传输

Description

You are given a string s1s_1 that is formed by repeatedly concatenating some string s2s_2 (guaranteed to repeat at least 22 times). However, s2s_2 is unknown. You only need to determine the shortest possible length of s2s_2.

Input Format

The first line contains an integer LL, which is the length of the given string.

The second line contains a substring of s1s_1, consisting entirely of lowercase letters.

Output Format

Output a single line containing the shortest length of s2s_2.

8
cabcabca
3

Hint

Explanation for Sample Input/Output 1

For the sample, we can obtain abcabcabcabc\texttt{abcabcabcabc} by repeatedly concatenating abc\texttt{abc}. The input cabcabca\texttt{cabcabca} is its substring.

Constraints

For all test points, it is guaranteed that 1L1061 \le L \le 10^6.

Translated by ChatGPT 5