SP17804 SPCS - Gopu And Palindromes

Description

Gopu loves palindromes. A palindrome is a string which is same even when it is reversed. eg. aba, a, abba are palindromes whereas, ab is not a palindrome. Once Gopu was playing with string s, he thought of whether he can change this string into a palindrome or not. A "cool operation" takes some substring of string with the property that all the characters in the substring should be same. Let us say that substring has size L. Then he can reduce ther size of this substring by alteast 0 and atmost L - 1. eg. string is abbb, He can change substring bbb into b, bb, bbb (corresponding to not changing it at all) which will make the string s into ab, abb, abbb respectively. He can apply a "cool operation" as many times as he wishes. Find out whether he can convert the string into a palindrome or not? Output "YES" if possible, else output "NO".

Input Format

First line of input contains number of test cases T, (1

Output Format

For each test case output a single line containing "YES" or "NO" (without quotes) respectively to situation whether he can convert given string into palindrome or not?