#C3868. Taco Message Encryption

    ID: 47342 Type: Default 1000ms 256MiB

Taco Message Encryption

Taco Message Encryption

You are given an integer k and a message string. Your task is to encrypt the message using a Caesar cipher. In this cipher, each alphabetical character in the message is shifted by k positions in the alphabet. The shifting is cyclic, i.e. after 'z' comes 'a' (and after 'Z' comes 'A'). Non-alphabetical characters (such as digits, spaces, and punctuation) are not modified.

The encryption formula for an alphabetical character is given by:

\( \text{Encrypted} = \text{Char}((\text{ord}(c) - \text{ord}(base) + k) \mod 26 + \text{ord}(base)) \)

where \( base \) is \( 'a' \) for lowercase letters and \( 'A' \) for uppercase letters.

Read the input from standard input and output the encrypted message to standard output.

inputFormat

The input consists of two lines:

  • The first line contains an integer k representing the number of positions to shift.
  • The second line contains the message string which may include spaces and special characters.

outputFormat

Output the encrypted message as a single line to standard output.

## sample
3
meet at the treehouse at 5 pm
phhw dw wkh wuhhkrxvh dw 5 sp