class Caesar:
def __init__(self):
a = list('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ,.-!\'"')
b = a[3:] + a[:3]
self.emap = dict(zip(a,b))
self.dmap = dict(zip(b,a))
def encode(self, text):
tmp = [ (x in self.emap and self.emap[x] or x) for x in text ]
return ''.join(tmp)
def decode(self, text):
tmp = [ (x in self.dmap and self.dmap[x] or x) for x in text ]
return ''.join(tmp)