//CODECHEF
//PROBLEMCODE : RECNDSTR
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
string a;
cin >> a;
if(a.length() == 1){
cout << "YES" << endl;
}
else{
string sub = "";
sub = sub + a[0] + a[1];
int i = 0;
while(i < a.length()){
if(sub[i % 2] != a[i]){
break;
}
i++;
}
if(i == a.length()){
cout << "YES" << endl;
}
else{
cout << "NO" << endl;
}
}
}
return 0;
}
@
This is my approach to the problem, when the length of string is 1 then we can print YES, otherwise I am going to take the first two characters of the string to make a substring and compare this substring with the remaining string to find whether they are matching (eg :- considering string ababab, search the string whether the pattern is repeating till the end, if yes then print yes else no.
Am I missing any boundary cases, since I can’t find any.