Hidden Palindrome

4

2 votes
Problem

Little Louis has recently learnt a new word in his English class which reads same from either end. He is curious to find more similar words. His naughty friend poses him a challenge which goes as follows: He gives him a long word and asks him to find the length of the longest palindromic sub string.

Input Format:

T, the number of test cases. Following T lines contain the strings.

Output Format:

T lines indicating the length of the longest palindrome.

Constraints: 

1 <= T <= 1000 1 <= STRING LENGTH <= 20

Sample Input
2
Afsdaydreamaerdyad                             			
Abcbdb
Sample Output
15
3
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?