text. Cross out any characters (possibly none) so that the remaining characters, in their original order, form a palindrome: a string that reads the same left to right and right to left.
Return the greatest length of a palindrome you can get this way.text="racecars" → 7
Crossing out the final "s" leaves "racecar", a palindrome of length 7.
text="qxwxe" → 3
For example "xwx", length 3.
text="abcd" → 1
All letters differ, so only a single letter is a palindrome.
text consists of lowercase English letterstext="racecars"
7
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.