String remove duplicates

#include<bits/stdc++.h>
using namespace std;
int duplicateformatting(char str[],int n,int i)
{
cout<<str[i];
if(i==n)
{
return 1;
}
if(str[i]==str[i+1])
{
n–;
i++;

}

return duplicateformatting(str,n,i+1);

}
int main() {

char str[1500];
cin>>str;
int n=strlen(str);
duplicateformatting(str,n-1,0);
return 0;

}
how to delete that element help me.

Plz send your code by saving on ide so that I could tell the problem.

Code i have already sent.please checkbit

Your code needs some modification,
Plz use a void function instead of int, since here we are not required to return a single value rather we need only string to be returned, so change your function accordingly.