All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Mirror of Mahatma Gandhi
Tag(s):

Ad-Hoc, Easy

Problem
Editorial
Analytics

On the way to Dandi March, Gandhijee carried a mirror with himself.
When he reached Dandi, he decided to play a game with the tired people to give them some strength.
At each turn of the game he pointed out a person and told him to say a number N(possibly huge) of his choice.
The number was called lucky if that equals it's mirror image.

Input:
First line contains number of test cases T. Each test case contains a single integer N.

Output:
For each test case print "YES" if the number was lucky else print "NO" (quotes for clarity) in one line.

Constraints:
1 ≤ T ≤ 100
0 ≤ N ≤ 10100

Image for Sample Test Cases :

enter image description here

SAMPLE INPUT
2
101
020
SAMPLE OUTPUT
YES
NO
Explanation

For 1st case, as clear from the image "101" and it's mirror image are identical. Hence, output "YES". For 2nd case, "020" and it's mirror image are not identical. Hence output "NO".

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

Dandi March

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications