import re
def transform(text):
    text = re.sub("[^A-Z]", "", text.upper())
    return text

def lcs(a, b):
    if (not a) or (not b): return None
    for l in range(len(a), 0, -1):
        ss = None
        starta = -1
        startb = -1
        for ia in range(len(a)-l+1):
            s = a[ia:ia+l]
            ib = b.find(s)
            if ib>-1:
                if (not ss) or s