Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/string-eng-qisqa-davr

Shortest period of a string

Medium 1000 ms 128 MB 60%
Share

A string $s$ of lowercase Latin letters is given. $s$ is made by writing some string $p$ one or more times in a row (for example, abcabcabc is abc written $3$ times). Find the length of the shortest such $p$; if $s$ is not a repetition of any shorter string, the answer is $|s|$.

The smallest block that repeats through the string — its period

Input

One line containing the string $s$.

Output

One integer — the length of $p$.

Note

$1 \le |s| \le 10^{5}$
$s$ consists of lowercase Latin letters (a–z) only

Examples

Input #1
abcabcabc
Output #1
3
Input #2
abcd
Output #2
4

Sign in to submit a solution

Signing up is free and takes a minute.