Problem related to code(duplicate character formatting)

#include
using namespace std;
string remove_duplicates(string s1,int i)
{
if(s1[i]==’\0’||s1[i+1]==’\0’)
{
return s1;
}

if(s1[i]==s1[i+1])
{
    int k=i;
    while(s1[k]!='\0')
    {
        k++;
    }
    s1[k+1]='\0';
    for(int j=k;j>i+1;j--)
    {
        s1[j]=s1[j-1];
    }
    s1[i+1]='*';
    return(remove_duplicates(s1,i+2));
}
return(remove_duplicates(s1,i+1));

}
int main()
{
string s;
int i=0;
cin>>s;
s=remove_duplicates(s,0);
while(s[i]!=’\0’)
{
cout<<s[i];
i++;
}
}

Hey @anmol_garg123 share your code using ide.codingblocks.com

hello @anmol_garg123
pls share ur code using cb 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.