#C6138. Decode Caesar Cipher

    ID: 49865 Type: Default 1000ms 256MiB

Decode Caesar Cipher

Decode Caesar Cipher

You are given a message encoded with the Caesar cipher. In this cipher, each letter is shifted by a fixed number of positions in the alphabet. For example, decoding 'DGGD' with a shift of 3 yields 'ADDA', and decoding 'KHOOR' with a shift of 3 gives 'HELLO'.

For each uppercase letter c in the message, its decoded version is computed as follows:

$$ decoded = \left( (\text{ord}(c) - \text{ord}('A') - shift) \mod 26 \right) + \text{ord}('A') $$

Your task is to implement a program that reads an encoded message and a shift value from standard input and prints the decoded message to standard output.

inputFormat

The input consists of two lines:

  • The first line contains the encoded message as a string of uppercase letters.
  • The second line contains an integer representing the shift value.

outputFormat

The output should be a single line containing the decoded message.

## sample
DGGD
3
ADDA