HELP TO EXTRACT MISTAKE

I AM GETTING WRONG ANSWER.
QUES LINK-TICKETS5 Problem - CodeChef

#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;
}

Please provide a properly indented code. The above code also contains lots of “” for no reason

{=“” scanf(“%s”,&s);=“” l=“strlen(S);” for

Please provide an ideone link or something similar instead of pasting code here.

Also I checked, you have successfully solved the problem : CodeChef: Practical coding for everyone

You can provide the solution link like this in case of wrong answer as well. These link would be helpful to understand your code.

Your code doesnt run at all for S of length 2.

Input
1
AB
Your output
(blank. Nothing printed)
Expected Output
YES

You are doing too much with the conditions. Simplify the thinking. What i suggest, is, that you check that adjacent elements are unequal, and that string has only 2 characters.