RECNDSTR - Editorial

for i in range (int(input())):
list = input()
setOfList=set(list)
if len(setOfList)==1 or len(list)==2:
print(‘YES’)

elif len(list)%2==0 and all(list[0] == c for c in list[: : 2]) and all(list[1] == c for c in list[1: : 2]):
    print('YES')

else:
    print('NO')