Longest palindrome

Given a string ss, please compute the longest sufix of ss that is a palindrome, that is, that reads the same backward as forward.

Input

Input consists of several ss, each one made up of between 1 and 10610^6 lowercase letters.

Output

For every ss, print the length of the longest sufix of ss that is a palindrome.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:40:41.868Z

© Jutge.org, 2006–2026.
https://jutge.org