A page in a colouring book has a row of coloured circles. You are given a string circleColours, where each letter is the colour of one circle, from left to right. For example, 'r' is red and 'b' is blue.
You may erase any circles. You cannot move or swap circles.
The circles you keep must make a palindrome pattern: their colours read the same from left to right and from right to left.
Return the maximum number of circles you can keep.
int maxCirclesKept(String circleColours)
circleColours: the colours of the circles from left to right, one letter per circle1 ≤ circleColours.length() ≤ 1,000circleColours contains only lowercase English lettersInput: maxCirclesKept(circleColours = "rgybgr")
Output: 5
Explanation: Erase the blue circle. The kept circles are "rgygr", which reads the same from both sides.
Input: maxCirclesKept(circleColours = "yrgbgro")
Output: 5
Explanation: Erase the first circle (yellow) and the last circle (orange). The kept circles are "rgbgr".
Input: maxCirclesKept(circleColours = "rgbyo")
Output: 1
Explanation: All colours are different, so only one circle can be kept. One circle on its own is a palindrome pattern.
Input: maxCirclesKept(circleColours = "rbwwbr")
Output: 6
Explanation: The row is already a palindrome pattern, so no circle is erased.