Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Zain and Zion are best friends. Their favourite game is finding palindromic numbers. But today Zion wanted to make the game more interesting. So he made some rules for the game. The rules are given below:

- The Number will be given in words. You have to convert the word into numbers. (The word will always be a valid number spelling)
- Convert the corresponding number into binary.
- Find if its binary form is palindrome or not.

Now, Zain got stuck with these rules. Can you help Zain to play the game by writing a simple program?

First line will have T, the number of test cases. Next T lines will contain a string S which will be a valid number in words. (1 <= T <= 10000). The valid number will be less than ten thousand. All letters will be in lower case.

You have to print “YES” if the number’s binary form is a palindrome, otherwise print “NO” without quotation mark.

Input | Output |
---|---|

2 two two hundred fifty five | NO YES |

**Note**: In the sample, Binary of two is (10)_{2} . From the definition of Palindromic Number we know “A palindromic number is a number that remains the same when its digits are reversed”. And binary of 2(two) doesn’t meet the definition.

81% Solution Ratio

Swarna_1603033Earliest,

zunaedFastest, 0.0s

tanimahossainLightest, 131 kB

AmiriShavakiShortest, 1321B

Login to submit