def myfunc(x, y):
    for i in range(len(x),0,-1):
        for j in range(len(x)-i+1):
            if x[j:j+i] in y:
                return i
    return 0

while True:
    try:
        a,b = input().lower(), input().lower()
        if len(a) > len(b):
            a,b = b,a
        print(myfunc(a, b))
    except:
        break