A palindrome is a sequence of characters which reads the same backwards and forwards. Given the string s, complete a solution function that returns the length of the longest palindrome within the substrings of s.

For example, when string s is "abcdcba", return 7.

  • Length of string s: a natural number less than or equal to 2,500
  • The string s consists only of lowercase alphabetic characters

s answer
"abcdcba" 7
"abacde" 3

Example #1
Returns 7 because the whole string s is palindrome based on the fourth digit "d".

Example #2
Returns 3 because "aba" is the palindrome based on the second digit "b".

Result Stop