I AM GETTING WRONG ANSWER.
QUES LINK-https://www.codechef.com/problems/TICKETS5
#include<stdio.h>
int main()
{
int T,l,i,j;
char S[100];
scanf("%d",&T);
for(i=0;i<T;i++)
{
scanf("%s",&S);
l=strlen(S);
for(j=0;j<l-2;j++)
{
if(S[j]==S[j+2]&&l%2==0&&S[j]!=S[j+1]&&S[j]>64&&S[j]<91&&l>1)
{
if(j==l-3)
printf("YES\n");
else
continue;
}
else
{
printf("NO\n");
break;
}
}
}
return 0;
}