Please identify the problem in my logic

#include
#include
using namespace std;

void replace(char a[],int i)
{
if(a[i]==’\0’||a[i+1]==’\0’)
{
return;
}

if(a[i]==a[i+1])
{
	int j=strlen(a);
	while(j>i)
	{
		a[j+2]=a[j];
		j--;
	}
	a[i+1]='*';
replace(a,i+2);	
}
replace(a,i+1);

}
int main() {
char string[10000];
cin>>string;
replace(string,0);
cout<<string;
return 0;
}

Hey @amangupta,

You have to just add a star between the same characters.
Following is very simple logic:

Also, the way you have shared your code has introduced many syntax errors to it.
Rather, share it using the online IDE.

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.