A subsequence of a string is what is left after deleting any number of its characters (possibly none) and keeping the rest in their original order. A palindrome reads the same from left to right as from right to left.
Given a string s, return the length of its longest subsequence that is a palindrome. The letters you keep don't have to sit next to each other in s.
Deleting r, a and b leaves elile, which reads the same both ways. No six letters of reliable form a palindrome.
carac uses the first c, the first a, the first r, the second a and the second c.
All four letters are different, so no two of them can mirror each other. Any single letter is a palindrome of length 1.
Constraints
1 <= s.length <= 1000s is made of lowercase English letters only.Look at the first and last letters. If they are equal, they can be the outer pair of the palindrome, around the best answer for what lies between them. If not, at least one of them is left out, so the answer is the better of the string without its first letter and the string without its last.
5