An alphadrome is a word in which each letter in the first half of the word "reflects" its alphabetical "opposite" in the second half of the word. Write a program or function that returns truthy if the given word is an alphadrome and falsey otherwise.
For example, BEEB
is a palindrome. Its first letter B
"reflects" its last letter B
, and its second letter E
reflects its second-to-last letter E
.
In contrast, BEVY
is an alphadrome. Its first letter B
is the second letter of the alphabet, and it reflects the word's last letter Y
, which is the second-to-last letter of the alphabet. Likewise, its second letter E
is the 5th letter of the alphabet, and it reflects V
, the 5th-from-the-end letter of the alphabet.
Like palindromes, an alphadrome can have an odd number of letters, too. WORLD
is an alphadrome. W
is the 4th-from-the-end letter of the alphabet and D
is the 4th letter; O
is the 12th-from-the-end letter of the alphabet and L
is the 12th letter. The center R
reflects itself.
Any single-letter word is an alphadrome.
Rules
Input words will include only the characters
a-z
orA-Z
, whichever is convenient.Output will be a truthy or falsey value.
Default I/O rules apply, standard rules apply, and standard loopholes are forbidden.
This is code golf. Shortest answer in bytes wins.
Test cases
A true
ABA false
ABZ true
ABBA false
BEVY true
GOLF false
ZOLA true
WIZARD true
BIGOTRY true
RACECAR false
ABCDEFGHIJKLMNOPQRSTUVWXYZ true
A
equal toZ
, and "A" doesn't equal "Z"? \$\endgroup\$