Kindly provide a hint to this problem cant seem to get an idea

Kindly provide any hint . Dont know what to do with K

@achin1tya,
K is the atmost number of character you can change, for e,g in sample input,

Sample Input
4
abba

We can change 1st b->a and 2nd b->a, i.e total number of changes = 2, and the perfectness = {aaaa} = 4.

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.