for _ in range(int(input())):
s = input()
f = 0
cnt, curr = 1, s[0]
for i in range(1, len(s)):
if(s[i]==curr):
cnt+=1
else:
if(cnt<=1):
f=1
break
cnt = 1
curr = s[i]
if(cnt<=1):
f=1
if(f==1):
print("NO")
else:
print("YES")
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
s+='c';
//cout<<s<<endl;
bool tell=true;
int cnt=1;
for(int i=0;i<s.length()-1;i++)
{
if(s[i]==s[i+1])
{
cnt++;
}
else
{
//cout<<cnt<<endl;
if(cnt!=1)
{
cnt=1;
continue;
}
else
{
tell =false;
break;
}
}
}
if(tell) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |