What's wrong in my code. Replace all pi

My code works for 1 string but not works for 3 or more string. I am not getting the output as expected. Please check what’s wrong.
code - https://ide.codingblocks.com/s/158668

you are not handling the string when size is <=1.

make a recursive call when size of left string is 1

suppose the string is “abpic”
on the 1st recursive call str=bpic and ans=“a”
after the 2nd rec call str=“pic” and ans=“ab”
after the 3rd rec call str=“c” and ans=“ab3.14”
after that there is no recursive call.

1 Like

thanks. got it.


now it is working.