#C11710. Shifting Uppercase Letters

    ID: 41057 Type: Default 1000ms 256MiB

Shifting Uppercase Letters

Shifting Uppercase Letters

You are given a string s and an integer k. Your task is to shift every uppercase letter in s forward by k positions in the English alphabet. If the shift takes the letter past 'Z', it wraps around to the beginning of the alphabet. All other characters remain unchanged.

The shifting formula for an uppercase letter is given by: \[ new\_value = ((ord(char) - ord('A') + k) \mod 26) + ord('A') \] where ord() returns the ASCII code of a character.

Example:

Input: HELLO, WORLD!
       3
Output: KHOOR, ZRUOG!

Make sure your program reads input from stdin and writes output to stdout.

inputFormat

The input consists of exactly two lines:

  • The first line contains the string s (which may include spaces, punctuation, and other characters).
  • The second line contains an integer k representing the number of positions to shift each uppercase letter.

outputFormat

Output the transformed string after shifting all uppercase letters forward by k positions. The result should be printed on a single line.

## sample
HELLO, WORLD!
3
KHOOR, ZRUOG!