#include<bits/stdc++.h>
using namespace std;
void replacePi(string in,string out)
{
if(in.size()==1){
cout<<out+in<<endl;
return;
}
if(in[0]!='p'){
string ch="" + in[0];
replacePi(in.substr(1),out+ch);
}
if(in.size()>=2 && 'p'==in[0] && 'i'==in[1]){
string bc="3.14";
replacePi(in.substr(2),out +bc);
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
replacePi(s,"");
}
}
This code is generating some weird characters in the output, what might be the problem??
!!