Vigenere cipher encryption

Write codeMedium22 min

Your task

Implement Vigenere cipher encryption. Given plaintext text and a key of letters, shift each alphabetic character of the text by the position of the corresponding key letter (a=0, b=1, ..., z=25), cycling through the key. Preserve the case of each text character. Non-alphabetic characters pass through unchanged and must NOT advance the key position. The key is non-empty and contains only ASCII letters.

Examples

vigenere_encrypt(text: str, key: str) -> str
Example 1
Inputvigenere_encrypt("HELLO", "KEY")
Output"RIJVS"