Wrong test cases in Problem Sanket and StringS

What’s wrong in my code -“https://ide.codingblocks.com/s/78231”…

test case:
2
abaabbb
correct Output:
6
your Output:
5
acc. to the question if we change 3rd and 4th element in the test case we will obtain abbbbbb which has max substring of similar elements which has size 6.
Run my code:

Can You Explain The logic of this code?

hey Ayush, Consider this
abaabbb (when No character is changed, 2 changes can be made)
abbabbb(after character at index 2 in changed, now 1 change can be made)
abbbbbb(after character at index 2 in changed, now 0 change can be made)

now we get a continous string b of length 6. So 6 is the answer.