All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Monk Teaches Palindrome
Tag(s):

Data Structures, String Algorithms, Very-Easy

Problem
Editorial
Analytics

Monk introduces the concept of palindrome saying,"A palindrome is a sequence of characters which reads the same backward or forward."
Now, since he loves things to be binary, he asks you to find whether the given string is palindrome or not. If a given string is palindrome, you need to state that it is even palindrome (palindrome with even length) or odd palindrome (palindrome with odd length).

Input:
The first line consists of $$T$$, denoting the number of test cases.
Next follow $$T$$ lines, each line consisting of a string of lowercase English alphabets.

Output:
For each string , you need to find whether it is palindrome or not.
If it is not a palindrome, print NO.
If it is a palindrome, print YES followed by a space; then print EVEN it is an even palindrome else print ODD.
Output for each string should be in a separate line.
See the sample output for clarification.

Constraints:
$$1 \le T \le 50$$
$$1 \le length \space of \space string \le 10^5$$

SAMPLE INPUT
3
abc
abba
aba
SAMPLE OUTPUT
NO
YES EVEN
YES ODD
Explanation

The first string is not a palindrome.
The second and third strings are palindromes of even and odd lengths respectively.

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

HackerEarth

Challenge Name

CodeMonk (Arrays & Strings)

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications