#include<bits/stdc++.h>
using namespace std;
void replaceChararcter(char *str,int i =0){
if(str[i]==β\0β or str[i+1]==β\0β){
return;
}
if(str[i]==str[i+1]){
int j = i + 1;
for (; str[j] != β\0β; j++){
str[j] = str[j+1];
}
replaceChararcter(str,i+1);
}
else{
replaceChararcter(str, i + 1);
}
}
int main()
{
char *arr = new char [100];
cin >> arr;
replaceChararcter(arr);
cout<<arr<<endl;
}
This is the code I wrote and Tried to copy link from Coding Blocks IDE but it did not copy . Kindly Let me know why is this approach wrong???