One test case giving wrong answer

link to ques-- https://hack.codingblocks.com/contests/c/457/335

#include
#include <string.h>
#include <math.h>
using namespace std;

void f(char * a, int t);
int main()
{
char a[20];

cin>>a;

f(a,0);

cout<<a;


return 0;

}

void f(char * a, int t)
{
if(t==strlen(a)) return ;

if(a[t]==a[t+1])
{
	for(int i=strlen(a);i>(t);i--)
	{
		a[i]=a[i-1];
	}
	a[t+1]='*';
}

f(a,t+1);

return ;

}

In your code, first of all iostream is not included ( I think it is a copy paste mistake)
Try your code for input as:
helllloooo.

You should take care of placing null character in ‘a’ as well . 'Coz when u are moving every element rightward then null character will get replaced by its previous element dat’s y u have to take care of it !
One more thing your logic for replacement of every element is wrong (I may start from higher index as well ) . So, try to build it first :wink: