[BOJ 10176] Opposite Words

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

One of the listeners of the NPR Sunday Puzzle show described the following puzzle: The word "wizard" has the peculiar property that its letters can be grouped in pairs,</p>

  • A and Z
  • B and Y
  • C and X
  • M and N

that are opposite each other in the alphabet. That is, A and Z are at opposite ends of the alphabet, C and X are three letters in from their respective ends, and M and N are 13 letters in from their respective ends. Can you name a well-known brand name in six letters that has this same property? Answer: La-Z-Boy (Notice the alphabetic opposites don't have to appear in opposite positions in the word)

Given a list of words you must determine which of the words are “opposite” words. Note that capitalization is not important when determining is a word is an “opposite” word.

입력 형식

The first line of input will be a positive integer, n, indicating the number of problem sets that follow. Following the positive integer will be n text strings, one per line.

출력 형식

For each problem set print “Yes” if the string is an “opposite” word and “No” if it is not an “opposite” word.

예제 입력

5
Wizard
Mark
La-Z-Boy
Love
Hello

예제 출력

Yes
No
Yes
Yes
No

Comments

There are no comments at the moment.