Cannot find error in return command

I am unable to comprehend why it’s not possible to return the string in the way i have returned it?

Kindly, give me conceptual knowledge of it!
Link:https: //ide.codingblocks.com/s/186199

Hi, I have corrected your code in the same link( and commented your original code).
Please have a look.
and some important points to notice.

  1. whenever you try to write a recursive function, always try to write its recursive definition mathematically first.
    like in this case:
    f(string str) = “3.14” + f(remaining string) if str starts with “pi”
    first character of str + f(remaining string) otherwise.

in recursive function , you can always observe that problem must be reduced in every next call. like in this case string become smaller and smaller.
so you should not call the recursive function again with same problem(same string in your case).

  1. whenever a recursive function is returning something, then you should make use of that returned thing, otherwise why are you returning anything.

Thanks

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.