Encrypt a message with a Caesar cipher. Given a string text and an integer shift, move every letter shift places forward in the alphabet, wrapping from z back to a. Uppercase letters stay uppercase, lowercase stay lowercase, and every other character (digits, spaces, punctuation) is copied unchanged. shift may be larger than 26 or negative.
Examples
Input: text = "Hello, World!", shift = 3
Output: "Khoor, Zruog!"
Input: text = "xyz", shift = 2
Output: "zab"
Input: text = "abc", shift = -1
Output: "zab"
Constraints
0 <= len(text) <= 2000-1000 <= shift <= 1000textmay contain letters, digits, spaces and punctuation
Goals
- Shift letters with `ord` and `chr`
- Wrap around the alphabet with modulo
- Leave non-letters untouched and preserve case