why is the end bracket coming in output
Print string within bracket using recursion
Your logic was correct but you made an error in doing substring.
https://ide.codingblocks.com/s/36554
I have made changes in your code and also commented your mistake. This passes all test cases successfully…