Compiled successfull but while submitting getting test case fail

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

void dc(string si,int i){
string ans="";
int s=si.size();
if(i==s){
cout<<ans;
}
if(i<s-1){

	if(si[i]==si[i+1]){
		cout<<si[i]<<"*";
		dc(si,i+1);
	}
	else{
		cout<<si[i];
		dc(si,i+1);
	}

}
}

int main() {
string si;cin>>si;
dc(si,0);
return 0;
}

hi @yashtripathi6969_0cd127807d833066 refer

inside string duplicateChar(string s) how if (s[0] == ros[0]) value of s[0] how it’s able to compare with other character of "ros"is increasin

inside string duplicateChar(string s) how if (s[0] == ros[0]) value of s[0] how it’s able to compare with other character of “ros”