#!/usr/bin/env pyth#
# Program to read a code file and a message file
# and encrypt the message file using the code file.
# This can also be used for decryption by reversing the two lines
# in the code file and putting the encrypted message into the file message
# Generating the code randomly is the job of createcode.py
#

   
fileicareabout = open("message","r")
message = fileicareabout.readlines()
fileicareabout.close()
fileicareabout = open("code","r")
code = fileicareabout.readlines()
fileicareabout.close()

def crypt(line): 
  out= ""
  for c in line:
    out+= mymap[c]
  return out

mymap = {}
for i in range(len(code[0])):
  mymap[code[0][i]] = code[1][i]

for line in message:
  print(line)
  print(crypt(line))


  


