Doubt regarding Sanket and Strings problem

Explanation is not given for this problem. Can you explain this problem by taking an example?

you can get a bit more explanation in this link:
https://hack.codingblocks.com/app/contests/1309/446/problem

other examples can be:

  1. input: 4 aaabababaaab
    output: 12 , as by changing all 4 b’s, you can convert all characters into a’s

  2. input: 2 aaabababaaab
    output: 7, you can change first 2 b’s into a, or middle 2 b’s into a (but not last 2 b’s). you will get max 7 continuous a’s.
    Thanks

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.