Rotating Letters
InterviewTime limit1sMemory limit128 MB
Given a single uppercase word, decide whether every letter belongs to the set of seven letters that look the same after a 180-degree rotation.
- Level
Easy2 of 10
- Topics
- String, Implementation, Hash map, Brute force
- Solved
- No attempts yet
Problem
An artist wants to build a sign whose letters rotate freely in the breeze. To do this, she may only use letters that look unchanged after a 180-degree rotation: I, O, S, H, Z, X, and N.
Given a single word, write a program that determines whether it can be used on the sign.
Input
The input consists of a single word made up only of uppercase letters, with no spaces. The word is at most 30 letters long and contains at least one letter.
Output
Output YES if the word can be used on the sign; otherwise, output NO.