while True: try: s1 = input() s2 = input() except EOFError: break if len(s1) > len(s2): s1, s2 = s2, s1 ret = 0 for i in range(len(s1)): for j in range(len(s2)): if s1[i] != s2[j]: continue n = 1 while ((n < len(s2) - j) and (n < len(s1) - i) and s1[i+n] == s2[j+n]): n += 1 if ret < n: ret = n print(ret)