#P3649. Palindromic Substring Maximum Existence Value
Palindromic Substring Maximum Existence Value
Palindromic Substring Maximum Existence Value
Given a string \( s \) consisting of lowercase Latin letters, define the existence value of a substring as the number of times the substring appears in \( s \) multiplied by its length. Among all palindromic substrings of \( s \), find the maximum existence value.
A palindrome is a string that reads the same forwards and backwards.
Note: The mathematical formula for a substring \( t \) is: \( existence(t) = (\text{count}(t)) \times (|t|) \), where \( |t| \) is the length of \( t \) and \( \text{count}(t) \) is the number of times \( t \) appears in \( s \).
inputFormat
The input consists of a single line containing the string \( s \), which is composed of lowercase Latin letters.
Example: aaa
outputFormat
Output a single integer, which is the maximum existence value among all palindromic substrings of \( s \).
Example: 4
sample
aba
3