https://ide.codingblocks.com/s/53147
this is my code but only 4 test cases are passed out of 6. please help regarding why the 2 test cases are failed.
String problem in CanYouReadThis
Hi Pankaj, see if the input is IAmA then your code will print:
I
Am
Instead of:
I
Am
A
Because in above case your if condition will run at line 13 when i = s.length() - 1. So your else if condition will not run.
So to get correct output change your else if condition to if