You are on page 1of 1

Everyone is fed up with the standard Subsequence Problems, so Zak is thinking of

ways this could be more interesting. He has acquired love for palindromes from
his BioInformatics classes.
The question he poses for you is given a string find the length of its largest s
ubsequence which is a palindrome. There could be many such subsequences but you
need to just print the length.
Note : A sunsequence of a string is obtained by deleting zero or more characters
from it.
Input Format: The first line of input contains T, the number of testcases. Then
follows T lines each containing a string.
Output Format: Output T lines, where ith line contains the required answer for i
th string in input.
Constraints : 1 <= T <= 10, length of any string in input is no more than 1000.
All characters are in [a-z].
Sample Input :
3
acba
qopera
gtopiuproatn
Sample Output:
3
1
7
Explanation:
Input string A required subsequence(length)
acba aba(3)
qopera p(1)
gtopiuproatn topupot(7)

You might also like