while True:
try:
a = list(input())
b = list(input())
c = []
len_a = len(a)
len_b = len(b)
for i in range(len_a + 1):
d = []
for j in range(len_b + 1):
d.append(0)
c.append(d)
result = 0
for i in range(1,len_a + 1):
for j in range(1,len_b + 1):
if(a[i - 1] == b[j - 1]):
c[i][j] = c[i - 1][j - 1] + 1
result = max(result,c[i][j])
print(result)
except:
break