A palindrome is a string that reads the same backward as forward. For example, BANANAB is a palindrome and BANANAS is not.
A subsequence is a string obtained by deleting zero or more characters from the original string. For example, ANNA is a subsequence of BANANAS.
You are given a string S and several distinct positions of S, called the special positions. Among the subsequences of S, find one that is a palindrome and contains as many special positions as possible. If several palindromic subsequences contain that maximum number of special positions, take the longest one among them and report its length.