problem

Given two strings, find the longest of the strings contained in both strings and write a program that answers that length.

Here, the string s included in the string t means that s appears consecutively in t. An empty string, that is, a string of length 0, is included in any string. For example, the string ABRACADABRA contains the following strings: ABRA, RAC, D, ACADABRA, ABRACADABRA, the empty string, etc. On the other hand, the string ABRACADABRA does not contain the following strings: ABRC, RAA, BA , K etc.



input

The input consists of multiple datasets. Each dataset is given in the following format.

The input consists of two lines, the first line is given the first string and the second line is given the second string. The strings consist of uppercase letters and each string is 1 in length. More than 4000 and less.

Of the scoring data, for 30% of the points, the length of each character string is 1 or more and 50 or less.

The end of input is indicated by EOF. The number of datasets does not exceed 10.

output

Outputs the length of the longest string contained in both of the two strings given for each dataset on one line.

Examples

Input

ABRACADABRA
ECADADABRBCRDARA
UPWJCIRUCAXIIRGL
SBQNYBSBZDFNEV


Output

5
0


Input

None


Output

None

Source: aizu | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def rolling_hash(S, base, MOD):
	l = len(S)
	h = [0] * (l + 1)
	for i in range(l):
		h[i + 1] = (h[i] * base + ord(S[i])) % MOD
	return h
C = open(0).read().split()
MOD = 358976445361682909
base = 31
for t in range(len(C) // 2):
	S = C[2 * t]
	T = C[2 * t + 1]
	rhs = rolling_hash(S, base, MOD)
	rht = rolling_hash(T, base, MOD)
	L = len(S)
	M = len(T)

	def solve(l):
		v = pow(base, l, MOD)
		hs = set()
		for i in range(L - l + 1):
			hs.add((rhs[i + l] - rhs[i] * v) % MOD)
		for i in range(M - l + 1):
			if (rht[i + l] - rht[i] * v) % MOD in hs:
				return 1
		return 0
	left = 0
	right = min(L, M) + 1
	while left + 1 < right:
		mid = (left + right) // 2
		if solve(mid):
			left = mid
		else:
			right = mid
	print(left)


while 1:
	try:
		s = input()
	except:
		break
	t = input()
	if len(s) < len(t):
		(s, t) = (t, s)
	a = sum((min(s.count(i), t.count(i)) for i in set(s) & set(t)))
	b = 0
	for x in range(len(t)):
		if len(t) - x <= b:
			break
		for y in range(b + 1, min(a + 1, len(t) - x + 1)):
			if t[x:x + y] in s:
				b = y
			else:
				break
	print(b)


while True:
	try:
		s1 = input()
	except EOFError:
		break
	s2 = input()
	BASE = 27
	MOD = 1000000007

	def rolling_hash(s):
		h_lst = [0]
		for c in s:
			h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
		return h_lst
	h_lst1 = rolling_hash(s1)
	h_lst2 = rolling_hash(s2)
	length1 = len(s1)
	length2 = len(s2)
	pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]

	def check(center):
		hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
		for i in range(length2 - center + 1):
			h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
			if h2 in hash_set:
				return True
		return False
	left = 0
	right = min(length1, length2)
	while right > left + 1:
		center = (left + right) // 2
		if check(center):
			left = center
		else:
			right = center
	print(right if check(right) else left)