Not correct output while reducing string length

not proper output when reducing string length/displacement for some input it gives the correct answer and sometimes its wrong need help to correct the code.

Hello @dasvishal60 check now:

1 Like

my code logic is good or bad ?? and isn’t my code too long ??
give suggestion. XD

@dasvishal60 if you have written yourseld in the first go then indeed you are good.
Well Done buddy!

yes, I have written by myself ty for help.

@dasvishal60 if you feek your query is cleared you can mark this 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.