#t112. 回文拼接

回文拼接

Palindrome Concatenation

Problem Description

A string is a palindrome if and only if it reads the same forwards and backwards, e.g. aabaa\texttt{aabaa} and ccddcc\texttt{ccddcc} are palindromes, but abcd\texttt{abcd} is not.

Xiao Yang has nn strings containing only lowercase letters. He wants you to write a program to determine whether each string can be formed by concatenating two palindromes, each of length at least 22, front to back.

Input Format

The first line contains a positive integer nn, representing the number of strings. The next nn lines each contain one string of lowercase letters only.

Output Format

For each string output one line. If the string can be formed by concatenating two palindromes each of length at least 22, output Yes; otherwise output No.

Sample Input

4
abcd
aabbb
aaac
abcdd

Sample Output

No
Yes
No
No

Sample Explanation

For the 44 strings in the sample input, check them one by one:

  • The first string abcd: we must split it into a front and a back part, each of length at least 22. The only possible split is ab and cd. ab reversed is ba, not a palindrome; cd is also not a palindrome. So it does not satisfy the condition, output No.
  • The second string aabbb: it can be split into aa and bbb. aa reads the same forwards and backwards, so it is a palindrome; bbb also reads the same, so it is a palindrome. Both parts have length at least 22, satisfying the condition, output Yes.
  • The third string aaac: possible splits are aa and ac, or aaa and c. In aaa and c, the back part has length only 11, failing the length-at-least-22 requirement; aa is a palindrome but ac is not. So it does not satisfy, output No.
  • The fourth string abcdd: the only length-satisfying splits are ab and cdd, or abc and dd. ab is not a palindrome; in abc and dd, the front part has length less than 22. So it does not satisfy, output No.

Constraints

For all test data, it is guaranteed that 1≤n≤101 \le n \le 10, and the length of each string does not exceed 100100.