Longest Palindromic Substring

MediumStrings
Next
StringDynamic Programming

Find the longest substring that is a palindrome and print its length.

Input

A single string of lowercase letters.

Output

Print the length of the longest palindromic substring.

Constraints

1 <= length <= 1000

Example 1
Input
babad
Output
3

bab (or aba) has length 3.

Example 2
Input
cbbd
Output
2

bb has length 2.

Hints

Longest Palindromic Substring - Medium Strings Problem | Skill Shiksha