Wrong answer please help

check my code please and help me

@saurabhvit
Save your code on ide.codingblocks.com and send me the link so that i can help you with it.

Please save your code on ide.codingblocks.com and share its link

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.

https://ide.codingblocks.com/s/229034 , Wrong answer Help

string replace(string s,int id)
{
if(s.length()<=1){
return s;
}
string res = replace(s,id);/// this will lead to infinite recursion because you are calling for same thing again and again
if(s[0]==‘p’ && res[0]==‘i’){
return res.substr(0,id) + “3.14” + res.substr(id+2);
}
else{
return res;
}
}

modified code is:https://ide.codingblocks.com/s/229051

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.