Test cases failing

why the test cases are failing

Hello @anupanu23,

Your code is failing for the test cases like:
1
abba
Expected Output:
3
Your Output:
4
Reason:
You can replace only 1 character.

Hope, this would help.
Try to correct your code and let me know if you face any issue.
Give a like, if you are satisfied.

sir according to your question it is written " maximum length substring of equal characters."

there is a difference between equal and same i thoughs untill the count of characters count are same the string is perfect

Hey @anupanu23,

Your reply is not clear.:sweat_smile:

BTW, the answer is 3 because for maximum length substring that can have same character(i.e. either all a or all b) is 3 for the case:
When you replace one a with b
i.e. bbb

Hope, this is clear now.

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.