## 16 Mar PMCA Saturday 18:30 Python Homework 21.03.13.

**Question:
**A palindrome is a word which is the same when read forwards as it is when read backwards. For example,

**and**

*mom***are two palindromes.**

*anna*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?

**Input Specification**

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

**Output Specification**

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

Sample Input 1bananaOutput for Sample Input 15Explanation for Output for Sample Input 1The palindromehas 5 letters.anana

Sample Input 2abracadabraOutput for Sample Input 23Explanation for Output for Sample Input 2The palindromesandacahave 3 letters, and there are no other palindromes in the input which are longer.ada

Sample Input 3abbaOutput for Sample Input 34

Sorry, the comment form is closed at this time.