#C3302. Substitution Cipher

    ID: 46715 Type: Default 1000ms 256MiB

Substitution Cipher

Substitution Cipher

You are given a text which needs to be either encrypted or decrypted using a basic substitution cipher. In this cipher, each letter in the text is shifted by a fixed number k through the alphabet. For encryption, the letter is shifted forward in the alphabet, while for decryption, it is shifted backward.

The shift value k satisfies the constraint \(1 \le k \le 25\). The text consists only of lowercase English letters and spaces.

For example:

Input:  e 3
       hello world
Output: khoor zruog

Your task is to implement the substitution cipher according to the given operation.

inputFormat

The input is read from standard input and consists of two lines:

  • The first line contains a character and an integer separated by a space. The character is either 'e' or 'd', representing encryption or decryption respectively, and the integer k is the shift value.
  • The second line contains the text, which consists of lowercase English letters and spaces.

outputFormat

The output is a single line printed to standard output containing the resulting text after applying the substitution cipher.

## sample
e 3
hello world
khoor zruog