atcoder#CF17FINALE. Combination Lock
Combination Lock
Score : points
Problem Statement
Ringo has a string .
He can perform the following kinds of operations any number of times in any order.
- Operation : For each of the characters from the -th through the -th characters in , replace it with its succeeding letter in the English alphabet. (That is, replace
a
withb
, replaceb
withc
and so on.) Forz
, we assume that its succeeding letter isa
.
Ringo loves palindromes and wants to turn into a palindrome. Determine whether this is possible.
Constraints
- consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print YES
if it is possible to turn into a palindrome; print NO
if it is impossible.
bixzja
2
2 3
3 6
YES
For example, if we perform Operation , and in this order, changes as bixzja
→ bjyzja
→ bjzakb
→ bkaakb
and becomes a palindrome.
abc
1
2 2
NO
cassert
4
1 2
3 4
1 1
2 2
YES