Palindrome 3 - Longest Palindrome (Hard)


Submit solution

Points: 15
Time limit: 1.0s
Memory limit: 128M

Problem type

Given a string \(S\), please determine the longest palindromic substring in \(S\). A palindrome is a sequence of letters that is the same when read forwards or backwards.

For this problem, Python users are recommended to use PYPY over CPython.

Input Specification

The first and only line will contain a string \(S\) consisting of lowercase letters in the English alphabet. This time, the length of \(S\) will not exceed \(10^{5}\) letters \((1 \le |S| \le 10^{5})\).

Output Specification

On a single line output an integer indicating the longest palindromic substring's length.

Sample Input 1

aaaba

Sample Output 1

3

Sample Input 2

aaabaaa

Sample Output 2

7

Comments

There are no comments at the moment.