String Window code not passing all the test cases

Code Link: https://ide.codingblocks.com/s/93489

Hi @tomarvikas738, consider the following test case:
aefrtyttydudqwwaawqqqwewb\ndsda
ed
The output should be: ewb\nd
But the output of your code is: ewb\ndsd
If you notice the difference in both outputs, you’ll notice that your code does not stop on the first occurrence of ‘d’. It still continues to search in the string.
Try to rectify this mistake. If the doubt still persists, reply to this thread else mark this doubt as resolved.

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.