What's the error

#include
#include<string.h>
using namespace std;

void replace_dup(char s[], int i){
if(s[i]==’\0’){
return;
}
if(s[i]==s[i+1]){
int j=i;
while(s[j]!=’\0’){
s[j+1]=s[j+2];
j++;
}
replace_dup(s, i+1);
}
else{
replace_dup(s, i+1);
}

return;

}

int main() {
char s[1000];
cin>>s;
replace_dup(s, 0);
cout<<s<<endl;

return 0;

}

// it’s giving wrong answer i think in some test cases

we need to remove the consecutive duplicates

Hi @popli.jivanshu
u can refer my code https://ide.codingblocks.com/s/631432
also whenever u send code save it on ide and send link…

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.