Longest Palindromic Subsequence
Submissions: 12109   Accuracy:

44.59%

  Difficulty: Easy   Marks: 2
Associated Course(s):   Interview Preparation

Given a String, find the longest palindromic subsequence

Input:
The first line of input contains an integer T, denoting no of test cases. The only line of each test case consists of a string S(only lowercase)


Output:
Print the Maximum length possible for palindromic subsequence.


Constraints:
1<=T<=100
1<=|Length of String|<=1000

 

Examples:
Input:

2
bbabcbcab
abbaab
Output:
7
4

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.