Shift cipher for letters and digits
Encrypt a message by shifting each letter K places forward in the alphabet (wrapping z to a, keeping its case) and each digit K places forward (wrapping 9 to 0). Other characters stay the same.
Reported in: TCS NQT (memory-based)
Input
First line: K. Second line: the message.
Output
The encrypted message.
Constraints
0 ≤ K ≤ 10^9; 1 ≤ length ≤ 10^5.
Example 1
Input:
3
OU2026 rocks!
Output:
RX5359 urfnv!Example 2
Input:
27
zZ9
Output:
aA6Hint: Use (position + K) mod 26 for letters and mod 10 for digits.