J3. Hidden Palindrome
의견: 0
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.
banana5The palindrome anana has 5 letters.
abracadabra3The palindromes aca and
ada have 3 letters, and there are no other
palindromes in the input which are longer.
abba4평가 및 의견
J3. Hidden Palindrome
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
J3. Hidden Palindrome