Something unexpected happened with this submission. Let's see if Genie can help.
Asked in Google Interview 2024 : SDE - I
Given a string S
, find the length of the longest palindromic subsequence in S
.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
The first and only line of input contains the string S
consisting of only lowercase English alphabets.
(1 ≤ |S| ≤ 1000
)
Output a single integer representing the answer.
S
consists only of lowercase English alphabets.1 ≤ |S| ≤ 1000
Input:
bbbab
Output:
4
Input:
cbbd
Output:
2