Remarkable Substrings#6463

Remarkable Substrings

3 seconds
512 megabytes
Very hard

Let be a string consisting of uppercase English letters. A nonempty string is called a remarkable string of rank with respect to if the string k \cdot T = T + T + \ldots + T (that is, repeated times) is a substring of . More formally, S = U + k \cdot T + V where and are some (possibly empty) strings.

Given a string , find the maximum possible rank such that there exists a string which is a remarkable string of rank with respect to .

Input

The only line of input contains the string (1 \leq |S| \leq 10^6). It is guaranteed that consists only of uppercase English letters.

Output

Print one number: the maximum rank of a remarkable string with respect to .

Examples

Example 1

Loading
Loading