Caesar Encryption

View as PDF

Submit solution


Points: 20 (partial)
Time limit: 1.0s
Memory limit: 32M

Authors:
Problem type
Allowed languages
Python

Problem Statement

Given a string S, you need to return the transformed string according to the following rule: If a character is a letter, it should be transformed to the next letter in the alphabet, except 'z' and 'Z', which should wrap around to 'a' and 'A', respectively. The capitalization should be preserved.

That is, 'a' becomes 'b', 'b' becomes 'c',..., 'y' becomes 'z', and 'z' becomes 'a'; 'A' becomes 'B',..., 'Z' becomes 'A'.

However, all other non-letter characters should remain unchanged.

Input Specification

The first line of the input gives the number of test cases, T, T test cases follow. Each test case consists of a line. The line contain a string S.

Limits

Memory limits: 32MB.

Time limits: 1 second.

1 \leq T \leq 100

0 \leq \text{length of S} \leq 1000

Test Set 1

Sample Case.

Test Set 2

The string S will not contain 'z','Z' or non-letter character.

Test Set 3

The string S will not contain non-letter character.

Test Set 4

No limitation.

Output Specification

For each test case, output one line containing Case #x: y, where x is the case number(starting from 1) and y is the transformed string.

Sample Input

2
Python3.7 is fun!
May I take Zoology 101 @ NTHU?

Sample Output

Case #1: Qzuipo3.7 jt gvo!
Case #2: Nbz J ublf Appmphz 101 @ OUIV?

Hint

chr ord mod operator


Comments

There are no comments at the moment.