Practice on Toph


Palindrome Again

By AnikaTahsin · Limits 1s, 512 MB

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:

  1. The Number will be given in words. You have to convert the word into numbers. (The word will always be a valid number spelling)
  2. Convert the corresponding number into binary.
  3. 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.


two hundred fifty five

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.



83% Solution Ratio

Swarna_1603033Earliest, 9M ago

zunaedFastest, 0.0s

tanimahossainLightest, 131 kB

omar24Shortest, 1281B


Login to submit