while True:
    try:
        s1 = input()
        s2 = input()
    except:
        break
    else:
        num=0
        if(len(s2)<len(s1)):
            s1,s2=s2,s1
        for i in range(len(s1)):
            for j in range(1,len(s1)+1):
                sub_s1=s1[i:j]
                if sub_s1 in s2 and (j-i)>num:
                    num=j-i
        print(num)