lucky-palindrome

A string is called a palindrome if it may be read the same way in either direction. For example, “12321” is a palindrome, but “12341” is not. A palindrome string can itself compose of one or more  palindrome sub-strings. Now, your task is to find out the length (denoted by L) of the longest palindrome sub-string, maximum-length contiguous substring of a given string that is also a palindrome, and print "YES" if it is lucky otherwise print "NO". A palindrome sub-string is called lucky iff it's length is a prime number.
For example : Consider a string s =”122321”. The longest palindrome sub-strings in s is of length 3. Hence, you need to output "YES" (quotes only for clarity).

Input :

The first line of input contains an integer T, the number of test cases. Then T test cases follow. Each test case consists of a line containing the string s.

Output :

Output on a new line the count as asked to determine in the problem statement.

Constraints :

1 ≤ T ≤ 100  

1 ≤ L ≤1000 , L - length of the string s.

SAMPLE INPUT
1
122321

SAMPLE OUTPUT
YES

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: