#K80207. Taco Decoder: Reverse Character Rotation
Taco Decoder: Reverse Character Rotation
Taco Decoder: Reverse Character Rotation
You are given an integer N and an encoded string E. The encoded string is produced by rotating each alphabetical character forward by N positions in the alphabet. Your task is to decode the string by rotating each character backward by N positions.
For each character c in the string:
$$decoded\_char = \text{chr}(((\text{ord}(c) - \text{ord}(base) - N) \mod 26) + \text{ord}(base))$$
where base
is 'A'
for uppercase letters and 'a'
for lowercase letters.
The decoded string should maintain the case of every letter.
inputFormat
The input consists of two lines:
- The first line contains an integer N.
- The second line contains the encoded string E, which consists of only uppercase and lowercase English letters.
outputFormat
Output a single line containing the decoded string.
## sample3
KhoorZruog
HelloWorld