how to solve this problem
https://codeforces.com/contest/1335/problem/E1
hello Manish,
editorial for this problem has been released
pls check -> https://codeforces.com/blog/entry/75993
editorial are published but not understandable
logic is simple.
let say u pick first x element of some character c.
now to make palindrome we will pick last x character of c .
and some elements of character y which comes in between those prefix and suffix.
this will always form palindrome.
cccccc(x times) … yyy …cccccc(x times) (assuming 2*x <= count of character c)
length of formed = 2*x + count of charcter y.
Now we need to maximise our length.
we can do it by choosing y whose occurence is highest between those prefix and suffix.
now try to read editorial . the editorial is based on this idea only
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.