here’s my code which passes the test case but is very different from editorial.
is my approach correct?
https://ide.codingblocks.com/s/59728
#include
#include
using namespace std;
string output;
void replace(string s, int i){
if(s[i] == ‘\0’){
cout<<output<<endl;
output = “”;
return;
}
if((s[i] == 'p') && (s[i+1] == 'i')){
output += "3.14";
i++;
}
else{
output += s[i];
}
replace(s,i+1);
}
int main() {
int test;
cin>>test;
while(test–){
string s;
cin>>s;
replace(s,0);
}
}