```def solution(s1, s2):
    mxlen = 0
    dp = [[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)]
    for i in range(len(s1)):
        for j in range(len(s2)):
            if s1[i] == s2[j]:
                dp[i+1][j+1] = dp[i][j] + 1
                if dp[i+1][j+1] >mxlen:
                    mxlen = dp[i+1][j+1]
    return mxlen


while True:
    try:
        s1 = input()
        s2 = input()
        print(solution(s1,s2))
    except:
        break;