97. Caesar's Secret Code

Acceptance — 0 accepted 0 submissions

Easy
MathStrings
No companies listed
Julius Caesar sent secret messages by shifting every letter forward by k places in the alphabet. After z, it wraps around to a.

With k = 3: a → d, x → a, z → c. Spaces stay as they are. Encode the message.

Input Format
The first line has the message (lowercase letters and spaces).
The second line has k.

Output Format
Print the encoded message.

Constraints
• 1 ≤ length ≤ 1000
• 0 ≤ k ≤ 1000

Example 1

Input
hello world
3
Output
khoor zruog

Explanation Each letter moves 3 steps: h → k, e → h, and so on.

Example 2

Input
xyz
3
Output
abc

Explanation x → a, y → b, z → c (wrapping around).

Example 3

Input
abc
26
Output
abc

Explanation Shifting by 26 is a full circle, so no change.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
khoor zruog
No results yet
Run your code to test it against the sample cases.
Problem List