Output is right still showing cases not passed

can you please guide me what is wrong in my code and which all test cases are not passed

maam can you please reply ??

Hey @1999atrijsharma
for input
2
aabbaababba
your answer is: 11
correct ans will be : 6 for aaaaaababba
correct this

maam i have changed the code , but now im getting TLE and cases not passed can you please help

@1999atrijsharma
Use two pointers for solving this question.

can you please send the helping code , so that i can get what exactly you mean to say as from my end the code is runnung perfectly fine

@1999atrijsharma
Refer to this code