Time limit: 1s
Memory limit: 256MB
Input:
Output:
Task
You are given a string , consisting only of lowercase Latin letters. The score of a string is defined as , where is the number of occurrences of in as a substring, and is the length of string . Your task is to find and print the maximum possible score of a string that appears in as a substring at least once.
Input data
The first line will contain the string .
Output data
The first line will contain a single integer, the maximum score found.
Constraints and clarifications
- For tests worth points, we have .
Example 1
stdin
aaa
stdout
4
Explanation
An optimal string is .
Example 2
stdin
ab
stdout
3
Explanation
The only optimal string is .