Test case 1 and 2 are failing

#include
using namespace std;

void duplicate(char a[], int i )
{
//base case
if(a[i]==’\0’)
{
return;
}
//recursive case
if(a[i]==a[i+1])
{
int j=i+1;
while (a[j]!=’\0’)
{
j++;
}
while (j>=i+1)
{
a[j+1]=a[j];
j–;
}
a[i+1]=’*’;
}
else duplicate( a , i+1);
}

int main() {

char a[10000];
int i=0;
cin>>a;

duplicate (a,0);
cout<<a;




return 0;

}

@ramitkapoor i have changed your code a little bit
when we found a element which is same to the element next to it we will shift all the elements except the element next to the current element and then check for the same element
else
we will check for the next element
Coding Blocks IDE
this is the changed code and if it not works let me know and if clear please mark my experience

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.