How to save last charater because it get replaced by previous one

#include<bits/stdc++.h>
using namespace std;
void remove_duplicate(char s)
{
if(s[0]==’\0’)
{
return;
}
if(s[0]==s[1])
{
int i=2;
while(s[i]!=’\0’)
{
s[i]=s[i-1];
i++;
}
s[1]=’
’;
}
remove_duplicate(s+1);
}
int main()
{
char s[1000];
cin>>s;
remove_duplicate(s);
cout<<s<<endl;
}

hi @rohitkandpal683 instead of overwriting characters in that string itself, you can use a differene character array for the output.