In a Caesar cipher, all characters in an input string are shifted by a number of positions. In other words, with a shift of 3 A
becomes D
, while with a shift of -2 F
becomes D
. Given an encoded string
Note that Z
shifted by an B
. Letter casing matters!
Input Specification
On one line,
Output Specification
The decoded
Sample Input
Copy
12
Qx Bek Oazsdaa
Sample Output
Copy
El Psy Congroo
Comments
Will the entire input be on one line, always?
If you mean the text that will be decoded than yes.
Yeah I got it, thanks
Sorry, this may be dumb of me but how does Q become E? Shifting Q 12 spaces gets me to C, not E. Am I missing something here? If someone could clarify this, it would greatly be appreciated.
Although the problem is called Encode, you are actually supposed to output the decoded string. You shift to the right when you encode, so you should shift the other way when decoding.
If you guys have the time, can you reword this problem? In the beginning, I thought
would result in Q wrapping around to C, and not the other way around. Thanks.
It says "Given an encoded string, output the decoded string".