a = input() b = input() s = [] if len(a) > len(b): a, b = b, a # a存短的字符串 n = len(a) for i in range(0, n): for j in range(0,i + 1): if a[j:n- i + j] in b: s.append(len(a[j:n - i + j])) s.append(0) print(max(s))