import re
def letters_finding(text:str):
ret=""
# 将所有字母替换为小写字母
text=text.lower()
# 使用正则表达式查找所有字母
letters = re.findall(r'[a-zA-Z]', text)
for letter in letters:
ret+=letter
return ret
def shift_cipher_encryption(m:str,k:int):
letters=letters_finding(m)
cipher=""
for letter in letters:
cipher+=chr(((ord(letter) - ord('a') + k) % 26) + ord('a'))
return cipher
def shift_cipher_decryption(c:str,k:int):
return shift_cipher_encryption(c,-k)