The code is not working for last two test cases? What I am missing here?
Why it is not working for last two test cases
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
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.