#P4391. [BalticOI 2009] Radio Transmission 无线传输
[BalticOI 2009] Radio Transmission 无线传输
Description
You are given a string that is formed by repeatedly concatenating some string (guaranteed to repeat at least times). However, is unknown. You only need to determine the shortest possible length of .
Input Format
The first line contains an integer , which is the length of the given string.
The second line contains a substring of , consisting entirely of lowercase letters.
Output Format
Output a single line containing the shortest length of .
8
cabcabca
3
Hint
Explanation for Sample Input/Output 1
For the sample, we can obtain by repeatedly concatenating . The input is its substring.
Constraints
For all test points, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号