Palindrome 2 - Longest Palindrome (Easy)


Submit solution

Points: 7
Time limit: 0.5s
Java 8 1.5s
Memory limit: 64M
Java 8 256M

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.

Input Specification

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

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.