Challenges - Strings, Piyush and Magical Park

Not able to pass all the test cases.
Code link - https://ide.codingblocks.com/s/197765

I have edited your code… Try to submit it now…