Longest Palindromic Subsequence
Print the length of the longest subsequence of S that is a palindrome.
Input: one line with the string S.
Output: the longest palindromic subsequence length.
Constraints:
- 1 ≤ |S| ≤ 1000
- lowercase letters
Sample Tests
Input 1
bbbab
Output 1
4
Input 2
abcd
Output 2
1
Discussion (opens after you solve — no spoilers before)
No comments yet.