Please debug this code

Please debug my code.
Problem link: Snake Procession Practice Problem in Level up from 1* to 2* - CodeChef

My code:
include <stdio.h>
#include<string.h>

int main(void) {
// your code goes here
int t,n,i;
char hex[500];
scanf(“%d”,&t);
while(t–)
{ memset(hex,‘\0’,sizeof(hex));
int p=0;
scanf(“%d”,&n);
scanf(" %s",hex);
char expect=‘H’;
for(i=0;i<n;i++)
{
if(hex[i]==‘.’)
{ continue;}
else if(hex[i]==‘H’&& expect==‘H’)
{
expect=‘T’;
}
else if(hex[i]==‘T’&& expect==‘T’)
{
expect=‘H’;
}
else
{
p=6;
printf(“Invalid\n”);
break;
}
}
if(hex[n-1]==‘H’)
printf(“Invalid\n”);
else if(expect==‘T’&&p==0)
printf(“Invalid\n”);
else
printf(“Valid\n”);
}
return 0;
}

@debanjon
plzz send your code in proper format so that it can be readable.

Well, I solved it. Thanks.