#C11137. Decrypt Message
Decrypt Message
Decrypt Message
You are given an integer \( k \) and an encrypted message consisting of letters, spaces, punctuation, and digits. The encryption process shifts every alphabetical character \( k \) positions forward in the alphabet (with wrap-around). Your task is to reverse this process: decrypt the message by shifting each alphabetical character \( k \) positions back.
Specifically, for each character in the message:
- If it is an uppercase letter (A–Z), shift it back by \( k \) positions. The result should still be an uppercase letter.
- If it is a lowercase letter (a–z), shift it back by \( k \) positions. The result should still be a lowercase letter.
- All other characters (digits, punctuation, spaces, etc.) remain unchanged.
For example, if \( k = 3 \) and the encrypted message is "khoor zruog", the decrypted message should be "hello world".
inputFormat
The input is given via standard input (stdin) and consists of two lines:
- The first line contains one integer \( k \) (the number of positions each letter was shifted).
- The second line contains the encrypted message as a string. The string may include spaces and punctuation.
outputFormat
Output the decrypted message as a single line to standard output (stdout).
## sample3
khoor zruog
hello world