bcdef
abbbc
 z
y
 reddit
abcdef
 abc
aaa
 y
z
 cbxz
aaaa

bccdb
 z
 dfdeed
 aab
 y
 abac

def getLowest(a, b):
	startingIndex = 0
	backIndex = -1
	size = len(a)
	index = 0
	while(index < size):
		if(a[startingIndex] <= b[backIndex]):
			return 0
		index += 1
		backIndex -= 1
	return size - 1

def getHighest(a, b):
	startingIndex = 0
	backIndex = -1
	size = len(a)
	index = 0
	while(index < size):
		if(b[backIndex] >= a[startingIndex]):
			return 0
		index += 1
		startingIndex += 1
	return size - 1

oleg = raw_input()
igor = raw_input()

olegLetters = sorted(oleg)
igorLetters = sorted(igor)


index = 0

length = len(oleg)

company_name = [0] * length

turn = 0



while index < length:
	position = 0
	if(turn == 0):
		while(company_name[position] != 0):
			position += 1
		position += getLowest(olegLetters, igorLetters)
		neg_index = -1
		if(position > length):
			while(company_name[neg_index] != 0):
				neg_index -= 1
			position = neg_index
		company_name[position] = olegLetters[0]
		olegLetters = olegLetters[1:]
		turn = 1
	else:
		while(company_name[position] != 0):
			position += 1
		position += getHighest(olegLetters, igorLetters)
		neg_index = -1
		if(position > length):
			while(company_name[neg_index] != 0):
				neg_index -= 1
			position = neg_index
		company_name[position] = igorLetters[-1]
		igorLetters = igorLetters	[:-1]
		turn = 0
	index += 1

print ''.join(str(x) for x in company_name)
