Getting wrong -answer in last test case

not getting why its not working for last test case
here is my code;

#include
#include
using namespace std;
void duplicatechar(char *a,char *out,int t,int i){
int temp=strlen(a);
if(t==temp){
return;
}
out[i]=a[t];
if(a[t]==a[t+1]){

    out[++i]='*';
    
}
duplicatechar(a,out,t+1,i+1);

}
int main(){
char a[200];
cin>>a;
char out[200];
duplicatechar(a,out,0,0);
cout<<out;
return 0;

}

Hello @Himanshu0123,

How are you sure that there would not be more than 200 characters in the input?
Solution:

  1. Use string instead of char array.
  2. Increase the size to 1000.

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