# # by Prof. Dipak Ghosal # def main(): infile = open("abbreviations.txt", "r") d = {} for line in infile: temp = line.split(":") d[temp[0]]=temp[1].rstrip() infile.close() im = input("Please input the IM ") tim = "" templist = im.split() for i in templist: t = d.get(i, i) tim = tim + " " + t print(tim) main()