P4391 [BalticOI 2009] Radio Transmission

Description

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

Input Format

The first line contains an integer $L$, which is the length of the given string. The second line contains a substring of $s_1$, consisting entirely of lowercase letters.

Output Format

Output a single line containing the shortest length of $s_2$.

Explanation/Hint

#### Explanation for Sample Input/Output 1 For the sample, we can obtain $\texttt{abcabcabcabc}$ by repeatedly concatenating $\texttt{abc}$. The input $\texttt{cabcabca}$ is its substring. #### Constraints For all test points, it is guaranteed that $1 \le L \le 10^6$. Translated by ChatGPT 5