Problem: In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A substring of a string is a continuous subsequence of the string. For example, BCD is a substring of ABCDEF.

You are given two strings s1, s2 and another string called virus. Your task is to find the longest common subsequence of s1 and s2, such that it doesn't contain virus as a substring.

Input

The input contains three strings in three separate lines: s1, s2 and virus (1 ≤ |s1|, |s2|, |virus| ≤ 100). Each string consists only of uppercase English letters.

Output

Output the longest common subsequence of s1 and s2 without virus as a substring. If there are multiple answers, any of them will be accepted. 

If there is no valid common subsequence, output 0.

Examples

Input

AJKEQSLOBSROFGZ
OVGURWZLWVLUXTH
OZ


Output

ORZ


Input

AA
A
A


Output

0

Solution (in PYTHON):

Solution:
MAX = 101 
NINF = -22222222222
base = [-1]*MAX
dp = [ [ base[:] for i in range(MAX)] for j in range(MAX)] 
s1 = ""
s2 = ""
s3 = ""
rev_s3 = ""
l1 = ""
l2 = ""
l3 = ""



def foo(i, j, k):
	if k == l3 :
		return "", NINF
	if i == l1:
		return "", 0
	if j == l2:
		return "", 0
	if dp[i][j][k] != -1:
		return dp[i][j][k]
	ans1, len1 = foo( i + 1, j, k )
	ans2, len2 = foo( i , j + 1, k )
	len3 = NINF
	ans3 = ""
	if s1[i] == s2[j]:
		if s1[i] == s3[k]:
			ans3, len3 = foo(i+1, j + 1, k+1 )
			ans3 += s1[i]
			len3 += 1
		else:
			if s1[i] == s3[0]:
				ans3, len3 = foo(i+1, j + 1, 1 )
			else:
				ans3, len3 = foo(i+1, j + 1, 0 )
			ans3 += s1[i]
			len3 += 1

	if rev_s3 in ans1:
		len1 = NINF
	if rev_s3 in ans2:
		len2 = NINF
	if rev_s3 in ans3:
		len3 = NINF

	if len1 > len2:
		if len1 > len3:
			dp[i][j][k] = ans1, len1 
		else:
			dp[i][j][k] = ans3, len3
	else:
		if len2 > len3:
			dp[i][j][k] = ans2, len2
			
		else:
			dp[i][j][k] = ans3, len3
	return dp[i][j][k]

s1 = raw_input()
s2 = raw_input()
s3 = raw_input()
rev_s3 = s3[::-1]
l1 = len(s1)
l2 = len(s2)
l3 = len(s3)

ans = foo(0,0,0)
if ans[1] <= 0 :
	print(0)
else:
	print(ans[0][::-1]	)