The Atbash cipher replaces each letter with its mirror in the alphabet: a becomes z, b becomes y, c becomes x, and so on. Uppercase letters mirror to uppercase. Anything that is not a letter is kept as it is. Given text, return the encoded string. (Applying Atbash twice gives back the original.)
Examples
Input: text = "abc"
Output: "zyx"
Input: text = "Hello 42!"
Output: "Svool 42!"
Constraints
0 <= len(text) <= 2000textmay contain letters, digits, spaces and punctuation
Goals
- Map `a` to `z`, `b` to `y`, and so on
- Preserve case and non-letters