Sanket and Strings Gettting only 33 score

Here’s the code

Your logic is not correct enough to pass all the test cases
For eg :
2
baaa
correct ans : 4
your ans : 3

0
baaa
correct ans : 3
your ans : 1

Correct your code , you have just changed the character of the string in accordance with k , consider string with both ‘a’ and ‘b’ for max value

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.