Sponsored
Use these hints if you're stuck. Try solving on your own first.
What is the maximum number of length-3 palindromic strings?
How can we keep track of the characters that appeared to the left of a given position?
Solve with full IDE support and test cases