Why it is not working for last two test cases

The code is not working for last two test cases? What I am missing here?

Hello @akhil54,

Your last submission is showing 100 points.

No ,not the last one, second last one.

Hey @akhil54,

After the while loop and before return 0, you also need to print substr(i,j-1) again,

cout<<s.substr(i,j-i)<<endl;
return 0;

Test case where your code won’t work

WR
Your ouptut: W
Correct Output:
W
R

@akhil54,

Did it work?

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.