Module: Prefix function, Z function


Problem

7 /10


Cyclic string

Problem

The string S was written many times in a row, after which a substring was taken from the resulting string and given to you. Your task is to determine the minimum possible length of the source string S.
 
Input
The input of the program is a string that contains only Latin letters, the length of the string does not exceed 50000 characters.
 
Output
Required to output a single number – answer  to the question of the problem.
 

 

Examples
# Input Output
1 z 1
2 abcdef 6