Runtime error occuring

code https://ide.codingblocks.com/s/52677
problem https://hack.codingblocks.com/contests/c/259/335

First of all, pls use STL in your code and make a new string and print that string.

void func(string& a,string& b,int i)
{
if(i==a.size()-1)
{ b=b+a[i]; return ; }

if(a[i]==a[i+1])
b=b+a[i]+"*";
else
b=b+a[i];
func(a,b,i+1);
}
int main()
{
string s;
cin>>s;
string n;
func(s,n,0);
cout<<n;
return 0;
}

what is problem with char array

There is no problem bt string provide more functionality than normal char array.

1 Like

thank you…