import string
plaintext = "hello world"
key = "xoyqmcgrukswaflnthdjpzibev"
alphabet = string.ascii_lowercase
cipher_dict = {}
for i in range(len(alphabet)):
cipher_dict[alphabet[i]] = key[i]
ciphertext = ""
for char in plaintext:
if char.lower() in cipher_dict:
ciphertext += cipher_dict[char.lower()]
else:
ciphertext += char
print(ciphertext)
decipher_dict = {}
for i in range(len(alphabet)):
decipher_dict[key[i]] = alphabet[i]
plaintext = ""
for char in ciphertext:
if char.lower() in decipher_dict:
plaintext += decipher_dict[char.lower()]
else:
plaintext += char
print(plaintext)