Piyush and magical park problem of string

I CANT BE ABLE TO SOLVE IT.PLEASE HELP

@amanm2292 hey aman do you want some hint regarding about sample test case ?.

yes i want hints for this problem

@amanm2292 hey aman try with this dry run of sample test case it will help you out. If you’re unable to code then let me know link.

can anyone help me in this question?

@amanm2292 hey aman I will suggest you to implement first if you are unable to implement do ask.