← 返回 tesla 的题目列表Caesar Cipher Encryption
类型:online_judge
Implement the function encrypt(text: str, rotation: int) -> str, which receives a string text and an integer rotation, and returns an encrypted string using the Caesar cipher. For each letter, replace it with the letter that is rotation positions down the alphabet.
Input:
A string text, with a maximum length of 10,000, consisting only of lowercase letters.
An integer rotation, ranging from 0 to 25.
Output:
The encrypted string.
Examples:
Input: "PINEAPPLE", 4
Output: "TMRIETTPI"
Input: "ZEBRA", 3
Output: "CHEUD"
Input: "NETWORK", 5
Output: "SIZTVRFQ"
Example
Input
PINEAPPLE 4