#P5433. Palindromic Card Sequence Value
Palindromic Card Sequence Value
Palindromic Card Sequence Value
Kaguya, the Moon Princess, discovered an ancient card sequence $$S$$ in the warehouse of Eien-tei. The cards are labeled from 0 and are represented by lowercase letters (from a to z), since the card deck size does not exceed 26. Kaguya is especially interested in contiguous subsequences that read the same from left to right and from right to left (i.e. palindromic substrings).
For a palindromic contiguous subsequence $$a$$ that occurs in $$S$$ from index $$l$$ to $$r$$ (0-indexed), define its midpoint as $$\left\lfloor \frac{l+r}{2} \right\rfloor$$. The value of the subsequence $$a$$ is the XOR of the midpoints of all its occurrences in $$S$$. Your task is to determine the maximum value among all palindromic contiguous subsequences of $$S$$.
inputFormat
The input consists of a single line containing the string $$S$$ composed of lowercase English letters.
outputFormat
Output a single integer, which is the maximum value among all palindromic contiguous subsequences of $$S$$.
sample
aba
2