atcoder#ABC232B. [ABC232B] Caesar Cipher
[ABC232B] Caesar Cipher
Score : points
Problem Statement
Takahashi has a string consisting of lowercase English letters.
On this string, he will do the operation below just once.
- First, choose a non-negative integer .
- Then, shift each character of to the right by (see below).
Here,
a
shifted to the right by isb
;b
shifted to the right by isc
;c
shifted to the right by isd
;y
shifted to the right by isz
;- z shifted to the right by 1 is a.
For example, b
shifted to the right by is f
, and y
shifted to the right by is b
.
You are given a string . Determine whether Takahashi can make equal by the operation above.
Constraints
- Each of and is a string of length between and (inclusive) consisting of lowercase English letters.
- The lengths of and are equal.
Input
Input is given from Standard Input in the following format:
Output
If Takahashi can make equal , print Yes
; if not, print No
.
abc
ijk
Yes
When Takahashi chooses ,
a
is shifted to the right by and becomesi
,b
is shifted to the right by and becomesj
,c
is shifted to the right by and becomesk
,
and now and are equal.
Therefore, he can make equal , so Yes
should be printed.
z
a
Yes
Choosing makes and equal.
Note that the letter on the right of z
is a
.
ppq
qqp
No
There is no non-negative integer that he can choose to make equal , so No
should be printed.
atcoder
atcoder
Yes
Choosing makes and equal.