What is the problem here !, all my testcases are fine bt i aint getting the first testcase

#include<bits/stdc++.h>
using namespace std;

void seperate(char str[],int i,char out[],int j){
if(str[i]==’\0’){
cout<<out<<endl;
return;
}
char a,b;
if(str[i]==str[i+1]){
a=str[i];
b=str[i+1];
out[j]=a;
out[j+1]=’*’;
out[j+2]=b;
seperate(str,i+1,out,j+2);
}
else if(str[i]!=str[i+1]){
out[j]=str[i];
seperate(str,i+1,out,j+1);
}

return ;

}

int main() {
char str[100];
cin>>str;
char out[200];
seperate(str,0,out,0);
return 0;
}

Hello @gabbar_2229,

As there is no constraint specified in the question,
so how are you so sure that there would not be more than 100 characters in the input?

Solution:
Resize your arrays to a greater value.
char str[1000];
char out[2000];

Suggestion:
Rather use a datatype where you need not to specify the length explicitly e.g. string.

Hope, this would help.
Give a like if you are satisfied.

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.