input1 = raw_input()
input2 = raw_input()
alist1, alist2 = [],[]
for i in input1:
	alist1.append(i)
n = 0
m = ''
for j in 
#~ for j in input2:
	#~ try:
		#~ if j == alist1[n]:
			#~ m += j
		#~ elif len(m) > len(alist1[0]):
			#~ alist2.pop()
		#~ elif j != alist1[n]:
			#~ alist2.append(m)
		#~ else:
			#~ print "Error!"
		#~ n += 1	
	#~ except:
		#~ pass
		#if len(m) > len(alist1[0]):
		#	alist1 = m
print m
