from functools import *
import re
def f(x,y):
    return x+y
def common(a,b):
    return filter(lambda x: x in a,b)

def cipher(s,n):
    return reduce(f,((map(lambda x:chr((ord(x.upper())-ord('A')+n)%26 + ord('A')),s))))

print (list(common([1,2,3,4,5],[2,4,6,8])))

print ((cipher("ABZ",3))) # "DEC"

pattern = "\w+@\w+\.\w+"
s = "some21+ older than 34"
m = re.search(pattern,s)
while m:
    print (m.group())
    print (m.start())
    print (m.end())
    print (m.span())
    s = s[m.end()+1:]
    m = re.search(pattern,s)
