Code not working

string func(string s)
{
if(s.length() == 1 or s.length() == 0)
return s;

if(s[0] == s[1])
{
	string small = func(s.substr(1));
    string ans = s[0] + "*" + small;
    return ans;
}	
else
{
	string small = func(s.substr(1));
    string ans = s[0] + small;
    return ans;
}

}

Please share your entire code using ide.codingblocks.com

Your submission is giving 100% result for the program, you can mark it as resolved.

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.