Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/string-eng-uzun-palindrom-qism

Longest palindromic substring

Medium 1000 ms 128 MB 63%
Share

A string $s$ of lowercase Latin letters is given. Find the length of the longest substring of consecutive letters that is a palindrome.

Finding the longest symmetric palindrome segment in the string

Input

One line containing the string $s$.

Output

One integer.

Note

$1 \le |s| \le 2000$
$s$ consists of lowercase Latin letters only

Examples

Input #1
abacabx
Output #1
5
Input #2
abcd
Output #2
1

Sign in to submit a solution

Signing up is free and takes a minute.