All Tracks Algorithms String Algorithms String Searching Problem

Palindrome
Tag(s):

Algorithms, Data Structures, Very-Easy

Problem
Editorial
Analytics

John loves to play with strings. Today he is playing with a special type of string called "palindrome". A palindrome is a string which reads the same backward and forward. John received a sack full of strings. There are T strings in the sack, he removes the strings one by one, John is happy if the string he picked is a palindrome. Once a string is chosen, he discards it.

Your task is to find for each string whether it is a palindrome or not. If the chosen string is a palindrome, print YES else print NO.

Input

The input consists of T strings each in a newline.

Output

For each string print YES, if the string is a palindrome else print NO.

Constraints

1 <= T <= 150

1 <= |lengthofString| <= 2000

SAMPLE INPUT
3
abba
aaaa
abcd
SAMPLE OUTPUT
YES
YES
NO
Explanation

You have given a string where you have to check if the given string is palindrome or not

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, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

L&T Infotech Fresher Hiring

Challenge Name

L&T Infotech Fresher Hiring Challenge (2016 Batch)

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications