Hidden Palindrome | 프로그래밍의 벗 PivotOJ
PivotOJ

Hidden Palindrome

시간 제한: 2000ms메모리 제한: 512MB출처: CCC 2016 JuniorBOJ 14040

문제

A palindrome is a word which is the same when read forwards as it is when read backwards. For example, mom and anna are two palindromes.

A word which has just one letter, such as a, is also a palindrome.

Given a word, what is the longest palindrome that is contained in the word? That is, what is the longest palindrome that we can obtain, if we are allowed to delete characters from the beginning and/or the end of the string?

입력

The input will consist of one line, containing a sequence of at least 1 and at most 40 lowercase letters.

출력

Output the total number of letters of the longest palindrome contained in the input word.

예제

예제 1

입력
banana
출력
5

예제 2

입력
abracadabra
출력
3

예제 3

입력
abba
출력
4
코드를 제출하려면 로그인하세요.