Showing wrong output

code-https://ide.codingblocks.com/s/291187

please do check my code

You are given that the string only contains ‘a’ and ‘b’. But you are iterating from A to Z. which is wrong in this wuestion. Otherwise it is correct. Change it to ‘a’ to ‘b’ and you’ll get it correct.


still same problem

You’re still running a loop till 26 . Which you should not do. Just use ‘a’ and ‘b’ to compute your answer/

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.

1 Like