Give you a string SS consisting of lowercase Latin letters. We define the existence value of a substring of the SS multiplied by the number of occurrences of the substring in the SS by the length of the substring.
For this string SS to you, ask for the maximum existence value in all palindrome substrings.
Input format
Row, a non-empty string SS consisting of a lowercase Latin alphabet (a~z).
Output format
Outputs an integer representing the maximum presence value in all palindrome substrings.
Sample One
Input
Abacaba
Output
7
Explanation
The length of the string SS is represented by ∣s∣∣s∣.
A substring of a string s1s2...s∣s∣s1s2...s∣s∣ is a non-empty string sisi+1...sjsisi+1...sj, where 1≤i≤j≤∣s∣1≤i≤j≤∣s∣. Each string is its own substring.
A string is called a palindrome and is identical only if the string is read from left to right and read from right to left.
In this example, there are 77 palindrome string A,b,c,aba,aca,bacab,abacaba. Their existence values are 4,2,1,6,3,5,74,2,1,6,3,5,7 respectively.
So the largest existence value in Palindrome substring is 77.
Example Two
Input
Www
Output
4
Restrictions and conventions
The first subtask has a total of 8 points, satisfying 1≤∣s∣≤1001≤∣s∣≤100.
The second subtask has a total of 15 points, satisfying 1≤∣s∣≤10001≤∣s∣≤1000.
The third subtask has a total of 24 points, satisfying 1≤∣s∣≤100001≤∣s∣≤10000.
The fourth sub-task has a total of 26 points to meet 1≤∣s∣≤1000001≤∣s∣≤100000.
The fifth sub-task has a total of 27 points to meet 1≤∣s∣≤3000001≤∣s∣≤300000.
Time limit: 1
[Bzoj 3676] [Uoj #103] "APIO2014" palindromes palindrome string suffix array +manachar