while True:
    try:
        a = input()
        b = input()
        if len(a) > len(b):
            a,b = b,a
        max_length = 0
        for i in range(len(a)):
            while max_length<len(a)-i:
                if a[i:i+max_length+1] in b:
                    max_length +=1
                else:
                    break
        print(max_length)
    except:
        break