forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTICKETS5.c
51 lines (47 loc) · 736 Bytes
/
TICKETS5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//Author: Rakshit Naidu
#include <stdio.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
char str[100];
scanf("%s",str);
int i,f=1;
char b = str[0];
char c = str[1];
if(b!=c)
{
for(i=2;str[i]!='\0';i++)
{
if(i%2==0&&str[i]==b)
{
f=1;
}
else if(i%2==1&&str[i]==c)
{
f=1;
}
else
{
f=0;
break;
}
}
}
else
{
f=0;
}
if(f==1)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}