Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.

To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each have a set of n letters (which might contain multiple copies of the same letter, the sets can be different). Initially, the company name is denoted by n question marks. Oleg and Igor takes turns to play the game, Oleg moves first. In each turn, a player can choose one of the letters c in his set and replace any of the question marks with c. Then, a copy of the letter c is removed from his set. The game ends when all the question marks has been replaced by some letter.

For example, suppose Oleg has the set of letters {i, o, i} and Igor has the set of letters {i, m, o}. One possible game is as follows :

Initially, the company name is ???.

Oleg replaces the second question mark with 'i'. The company name becomes ?i?. The set of letters Oleg have now is {i, o}.

Igor replaces the third question mark with 'o'. The company name becomes ?io. The set of letters Igor have now is {i, m}.

Finally, Oleg replaces the first question mark with 'o'. The company name becomes oio. The set of letters Oleg have now is {i}.

In the end, the company name is oio.

Oleg wants the company name to be as lexicographically small as possible while Igor wants the company name to be as lexicographically large as possible. What will be the company name if Oleg and Igor always play optimally?

A string s = s_1s_2...s_{m} is called lexicographically smaller than a string t = t_1t_2...t_{m} (where s ≠ t) if s_{i} < t_{i} where i is the smallest index such that s_{i} ≠ t_{i}. (so s_{j} = t_{j} for all j < i)


-----Input-----

The first line of input contains a string s of length n (1 ≤ n ≤ 3·10^5). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially.

The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This string denotes the set of letters Igor has initially.


-----Output-----

The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally.


-----Examples-----
Input
tinkoff
zscoder

Output
fzfsirk

Input
xxxxxx
xxxxxx

Output
xxxxxx

Input
ioi
imo

Output
ioi



-----Note-----

One way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. The company name becomes fzf????. Igor replaces the fourth question mark with 's'. The company name becomes fzfs???. Oleg replaces the fifth question mark with 'i'. The company name becomes fzfsi??. Igor replaces the sixth question mark with 'r'. The company name becomes fzfsir?. Oleg replaces the seventh question mark with 'k'. The company name becomes fzfsirk.

For the second sample, no matter how they play, the company name will always be xxxxxx.

Difficulty: MEDIUM_HARD
Tags: Sorting

Game theory

Greedy algorithms
Skill types: Sorting

Greedy algorithms

Starter code:

Solutions:
a = list(input())
b = list(input())
a.sort()
b.sort(reverse=True)
ans = list()
for i in a:
	ans.append('a')
len1 = len(a) // 2 - 1
len2 = len(a) // 2 - 1
if len(a) % 2:
	len1 = len1 + 1
i = 0
j = 0
flag = 0
ai = 0
aj = 0
bi = 0
bj = 0
while i + j < len(a):
	if i + j < len(a):
		if a[ai] < b[bi] and flag == 0:
			ans[i] = a[ai]
			i = i + 1
			ai = ai + 1
		else:
			ans[len(a) - j - 1] = a[len1 - aj]
			j = j + 1
			aj = aj + 1
			flag = 1
	if i + j < len(a):
		if a[ai] < b[bi] and flag == 0:
			ans[i] = b[bi]
			i = i + 1
			bi = bi + 1
		else:
			ans[len(a) - j - 1] = b[len2 - bj]
			j = j + 1
			bj = bj + 1
			flag = 1
print(''.join(ans))


from sys import *
f = lambda : sorted(stdin.readline()[:-1])
(a, b) = (f(), f())
n = len(a)
u = v = ''
(i, j) = (0, -1)
(x, y) = (n - 1 >> 1, n - 2 >> 1)
while x != -1:
	if a[i] < b[j]:
		u += a[i]
		i += 1
	else:
		v += a[i + x]
	x -= 1
	if y == -1:
		break
	elif a[i] < b[j]:
		u += b[j]
		j -= 1
	else:
		v += b[j - y]
	y -= 1
print(u + v[::-1])


import sys

def main():
	s = sys.stdin.readline().rstrip()
	t = sys.stdin.readline().rstrip()
	result = []
	iisl = 0
	iisr = len(s) // 2 + len(s) % 2 - 1
	iitl = 0
	iitr = len(s) // 2 - 1
	aas = list(sorted(list(s)))
	aat = list(sorted(list(t), reverse=True))
	rl = 0
	rr = len(s) - 1
	result = ['?'] * len(s)
	for i in range(len(s)):
		if i % 2 == 0:
			if aas[iisl] < aat[iitl]:
				result[rl] = aas[iisl]
				iisl += 1
				rl += 1
			else:
				result[rr] = aas[iisr]
				iisr -= 1
				rr -= 1
		elif aat[iitl] > aas[iisl]:
			result[rl] = aat[iitl]
			iitl += 1
			rl += 1
		else:
			result[rr] = aat[iitr]
			iitr -= 1
			rr -= 1
	sys.stdout.write(''.join(result) + '\n')
main()


s = input()
s1 = input()
n = len(s1)
sl = []
sl1 = []
for i in range(n):
	sl += [s[i]]
	sl1 += [s1[i]]
ans = sl1[:]
sl1.sort()
sl.sort()
sl1.reverse()
i = 0
i2 = (n - 1) // 2
k = 0
k2 = n // 2 - 1
j = len(s) - 1
temp = 0
for x in range(len(s1)):
	if x % 2 == 0:
		if sl[i] < sl1[k]:
			ans[temp] = sl[i]
			temp += 1
			i += 1
		elif sl[i] >= sl1[k]:
			ans[j] = sl[i2]
			i2 -= 1
			j -= 1
	if x % 2 == 1:
		if sl[i] < sl1[k]:
			ans[temp] = sl1[k]
			temp += 1
			k += 1
		elif sl[i] >= sl1[k]:
			ans[j] = sl1[k2]
			j -= 1
			k2 -= 1
print(''.join(ans))


a = list(input())
b = list(input())
n = len(a)
if len(a) == 1:
	print(a[0])
	return
a.sort()
b.sort()
a = a[:(len(a) + 1) // 2]
if n % 2 == 1:
	b = b[len(b) // 2 + 1:]
else:
	b = b[len(b) // 2:]
sa = 0
ea = len(a) - 1
sb = 0
eb = len(b) - 1
stb = 0
ste = n - 1
st = [''] * n
for i in range(n):
	if i % 2 == 0:
		if a[sa] < b[eb]:
			st[stb] = a[sa]
			sa += 1
			stb += 1
		else:
			st[ste] = a[ea]
			ea -= 1
			ste -= 1
	else:
		if eb == sb and n % 2 == 0:
			st[stb] = b[eb]
			break
		if b[eb] > a[sa]:
			st[stb] = b[eb]
			eb -= 1
			stb += 1
		else:
			st[ste] = b[sb]
			ste -= 1
			sb += 1
for i in range(len(st)):
	print(st[i], end='')


str1 = list(input())
str2 = list(input())
str1.sort()
str2.sort(reverse=True)
n = len(str1)
str = ['?'] * n
(i, j, ni, nj) = (0, 0, (n + 1) // 2 - 1, n // 2 - 1)
(front, rear) = (0, n - 1)
for cur in range(n):
	if cur & 1 == 0:
		if str1[i] < str2[j]:
			str[front] = str1[i]
			i += 1
			front += 1
		else:
			str[rear] = str1[ni]
			ni -= 1
			rear -= 1
	elif str1[i] < str2[j]:
		str[front] = str2[j]
		j += 1
		front += 1
	else:
		str[rear] = str2[nj]
		nj -= 1
		rear -= 1
print(''.join(str))


s1 = input()
s2 = input()
n = len(s1)
s1 = sorted(s1)
s2 = sorted(s2)[::-1]
i = 0
j = 0
res = ['?'] * n
rear = n - 1
front = 0
Neven = n % 2 == 0
n1 = (n + 1) // 2 - 1
n2 = n // 2 - 1
for k in range(n):
	if k % 2 == 0:
		if s1[i] < s2[j]:
			res[front] = s1[i]
			front += 1
			i += 1
		else:
			res[rear] = s1[n1]
			rear -= 1
			n1 -= 1
	elif s1[i] < s2[j]:
		res[front] = s2[j]
		front += 1
		j += 1
	else:
		res[rear] = s2[n2]
		rear -= 1
		n2 -= 1
print(''.join(res))


a = list(input())
b = list(input())
name = [None for _ in range(len(a))]
a.sort()
b.sort(reverse=True)
ai = 0
aj = (len(a) + 1) // 2 - 1
bi = 0
bj = len(b) // 2 - 1
turn = 0
ansi = 0
ansj = len(name) - 1
for _ in range(len(name)):
	if not turn:
		if a[ai] < b[bi]:
			name[ansi] = a[ai]
			ai += 1
			ansi += 1
		else:
			name[ansj] = a[aj]
			aj -= 1
			ansj -= 1
	elif b[bi] > a[ai]:
		name[ansi] = b[bi]
		bi += 1
		ansi += 1
	else:
		name[ansj] = b[bj]
		bj -= 1
		ansj -= 1
	turn ^= 1
print(''.join(name))


from collections import deque
a = sorted(input())
l = len(a)
a = deque(a[:(len(a) + 1) // 2])
b = sorted(input())
b = deque(b[len(b) - len(b) // 2:])
result = ['0'] * l
left = -1
right = l
while left <= right:
	if len(b) == 0:
		result[left + 1] = a[0]
		break
	if a[0] >= b[-1]:
		right -= 1
		result[right] = a[-1]
		a.pop()
	else:
		left += 1
		result[left] = a[0]
		a.popleft()
	if len(a) == 0:
		result[left + 1] = b[0]
		break
	if a[0] >= b[-1]:
		right -= 1
		result[right] = b[0]
		b.popleft()
	else:
		left += 1
		result[left] = b[-1]
		b.pop()
print(''.join(result))


from sys import stdin, stdout
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
a_count = 26 * [0]
b_count = 26 * [0]
length = len(a)
for i in range(length):
	a_count[ord(a[i]) - ord('a')] += 1
	b_count[ord(b[i]) - ord('a')] += 1
result = length * ['a']
left = 0
right = length - 1
(mina, minb, maxa, maxb) = (0, 0, 25, 25)
exclude = length // 2
for i in range(25, -1, -1):
	if exclude <= 0:
		break
	while exclude > 0 and a_count[i] != 0:
		exclude -= 1
		a_count[i] -= 1
exclude = (length + 1) // 2
for i in range(26):
	if exclude <= 0:
		break
	while exclude > 0 and b_count[i] != 0:
		exclude -= 1
		b_count[i] -= 1
while a_count[mina] == 0 and mina < 25:
	mina += 1
while b_count[minb] == 0 and minb < 25:
	minb += 1
while a_count[maxa] == 0 and maxa > 0:
	maxa -= 1
while b_count[maxb] == 0 and maxb > 0:
	maxb -= 1
i = 0
while i < length:
	if i & 1 == 0:
		if mina < maxb:
			result[left] = chr(ord('a') + mina)
			left += 1
			a_count[mina] -= 1
			while a_count[mina] == 0 and mina < 25:
				mina += 1
		else:
			result[right] = chr(ord('a') + maxa)
			right -= 1
			a_count[maxa] -= 1
			while a_count[maxa] == 0 and maxa > 0:
				maxa -= 1
	elif mina < maxb:
		result[left] = chr(ord('a') + maxb)
		left += 1
		b_count[maxb] -= 1
		while b_count[maxb] == 0 and maxb > 0:
			maxb -= 1
	else:
		result[right] = chr(ord('a') + minb)
		right -= 1
		b_count[minb] -= 1
		while b_count[minb] == 0 and minb < 25:
			minb += 1
	i += 1
print(''.join(result))


import sys

def solve():
	s = input()
	t = input()
	n = len(s)
	s = sorted(s)[:(n + 1) // 2]
	t = sorted(t, reverse=True)[:n // 2]
	ans = [''] * n
	ansl = 0
	ansr = n - 1
	olgl = 0
	olgr = len(s) - 1
	igol = 0
	igor = len(t) - 1
	for i in range(n):
		if i % 2 == 0:
			if igol > igor or s[olgl] < t[igol]:
				ans[ansl] = s[olgl]
				ansl += 1
				olgl += 1
			else:
				ans[ansr] = s[olgr]
				ansr -= 1
				olgr -= 1
		elif olgl > olgr or t[igol] > s[olgl]:
			ans[ansl] = t[igol]
			ansl += 1
			igol += 1
		else:
			ans[ansr] = t[igor]
			ansr -= 1
			igor -= 1
	print(''.join(ans))

def __starting_point():
	solve()
__starting_point()


from collections import deque
oleg = sorted(list(input()))
n = len(oleg)
oleg = deque(oleg[:n - n // 2])
igor = deque(sorted(list(input()), reverse=True)[:n // 2])
result = ['' for i in range(n)]
result_front = 0
result_rear = -1
o = True
while result_front - result_rear - 1 < n:
	if o:
		if len(igor) == 0 or oleg[0] < igor[0]:
			result[result_front] = oleg.popleft()
			result_front += 1
		else:
			result[result_rear] = oleg.pop()
			result_rear -= 1
	elif len(oleg) == 0 or igor[0] > oleg[0]:
		result[result_front] = igor.popleft()
		result_front += 1
	else:
		result[result_rear] = igor.pop()
		result_rear -= 1
	o = not o
print(''.join(result))


s = input()
t = input()
n = len(s)
vs = [0] * 26
vt = vs[:]
for i in range(n):
	vs[ord(s[i]) - 97] += 1
	vt[ord(t[i]) - 97] += 1
ns = n // 2 + n % 2
nt = n // 2
cur = 0
starts = 0
ends = 0
for i in range(26):
	if cur + vs[i] < ns:
		cur += vs[i]
	else:
		vs[i] = ns - cur
		cur = ns
		ends = i
		break
cur = 0
startt = 0
endt = 25
for i in range(25, -1, -1):
	if cur + vt[i] < nt:
		cur += vt[i]
	else:
		vt[i] = nt - cur
		cur = nt
		startt = i
		break
res = ['*'] * n
start = 0
end = n - 1
for i in range(n):
	while starts < 26 and vs[starts] == 0:
		starts += 1
	while ends >= 0 and vs[ends] == 0:
		ends -= 1
	while startt < 26 and vt[startt] == 0:
		startt += 1
	while endt >= 0 and vt[endt] == 0:
		endt -= 1
	while res[start] != '*':
		start += 1
	while res[end] != '*':
		end -= 1
	if i % 2 == 0:
		if starts >= endt:
			res[end] = chr(97 + ends)
			vs[ends] -= 1
		else:
			res[start] = chr(97 + starts)
			vs[starts] -= 1
	elif endt <= starts:
		res[end] = chr(97 + startt)
		vt[startt] -= 1
	else:
		res[start] = chr(97 + endt)
		vt[endt] -= 1
for i in range(n):
	print(res[i], end='')


a = sorted(input())
b = sorted(input(), reverse=True)
n = len(a)
a = ''.join(a[:(n + 1) // 2])
b = ''.join(b[:n // 2])
name = [''] * (len(a) + len(b))
ia = ib = ic = 0
ja = len(a) - 1
jb = len(b) - 1
jc = len(name) - 1
turn = 1
while ic <= jc:
	if turn == 1:
		if ib > jb:
			name[ic] = a[ia]
			ic += 1
		elif a[ia] < b[ib]:
			name[ic] = a[ia]
			ia += 1
			ic += 1
		else:
			name[jc] = a[ja]
			ja -= 1
			jc -= 1
	elif ia > ja:
		name[ic] = b[ib]
		ic += 1
	elif b[ib] > a[ia]:
		name[ic] = b[ib]
		ib += 1
		ic += 1
	else:
		name[jc] = b[jb]
		jb -= 1
		jc -= 1
	turn = 3 - turn
print(''.join(name))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	s = list(si())
	t = list(si())
	a = [''] * len(s)
	n = len(s)
	i1 = 0
	i2 = n // 2 + n % 2 - 1
	j1 = ceil(n, 2)
	j2 = n - 1
	p = 0
	q = n - 1
	s.sort()
	t.sort()
	turn = 0
	f = [0] * 26
	g = [0] * 26
	for i in range(n):
		f[ord(s[i]) - ord('a')] += 1
		g[ord(t[i]) - ord('a')] += 1
	cnt = 0
	while cnt < n:
		if turn == 0:
			flag = 1
			for k in range(26):
				if g[k] and k > ord(s[i1]) - ord('a'):
					flag = 0
					break
			if flag == 0:
				a[p] = s[i1]
				p += 1
				f[ord(s[i1]) - ord('a')] -= 1
				i1 += 1
			else:
				a[q] = s[i2]
				f[ord(s[i2]) - ord('a')] -= 1
				i2 -= 1
				q -= 1
		else:
			flag = 1
			for k in range(26):
				if f[k] and k < ord(t[j2]) - ord('a'):
					flag = 0
					break
			if flag == 0:
				a[p] = t[j2]
				p += 1
				g[ord(t[j2]) - ord('a')] -= 1
				j2 -= 1
			else:
				a[q] = t[j1]
				g[ord(t[j1]) - ord('a')] -= 1
				j1 += 1
				q -= 1
		cnt += 1
		turn ^= 1
	for i in a:
		print(i, end='')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
from math import sqrt

def solve():
	s = input()
	t = input()
	n = len(s)
	s = sorted(s)[:(n + 1) // 2]
	t = sorted(t, reverse=True)[:n // 2]
	ans = [None] * n
	ansl = 0
	ansr = n - 1
	olgl = 0
	olgr = len(s) - 1
	igol = 0
	igor = len(t) - 1
	for i in range(n):
		if i % 2 == 0:
			if igol > igor or s[olgl] < t[igol]:
				ans[ansl] = s[olgl]
				ansl += 1
				olgl += 1
			else:
				ans[ansr] = s[olgr]
				ansr -= 1
				olgr -= 1
			pass
		else:
			if olgl > olgr or t[igol] > s[olgl]:
				ans[ansl] = t[igol]
				ansl += 1
				igol += 1
			else:
				ans[ansr] = t[igor]
				ansr -= 1
				igor -= 1
			pass
	ans = ''.join(ans)
	print(ans)
solve()


def main():
	from collections import deque
	import sys
	input = sys.stdin.readline
	s = list(input())[:-1]
	t = list(input())[:-1]
	n = len(s)
	s.sort()
	t.sort(reverse=True)
	s = deque(s[:(n + 1) // 2])
	t = deque(t[:n // 2])
	f = 0
	(al, ar) = ('', '')
	for i in range(n):
		if i % 2:
			if s and s[0] >= t[0]:
				f = 1
			if f:
				ar += t.pop()
			else:
				al += t.popleft()
		else:
			if t and s[0] >= t[0]:
				f = 1
			if f:
				ar += s.pop()
			else:
				al += s.popleft()
	print(al + ar[::-1])
main()


oleg = input()
igor = input()
oleg = sorted(list(oleg))
igor = sorted(list(igor))
n = len(oleg)
oleg_turns = (n + 1) // 2
igor_turns = n // 2
min_oleg_id = 0
min_igor_id = n - igor_turns
ans = ['?'] * n
max_oleg_id = oleg_turns - 1
max_igor_id = n - 1
curr_turn = 'o'
next_turn = {'o': 'i', 'i': 'o'}
l_ans = 0
r_ans = n - 1
while r_ans >= l_ans:
	if curr_turn == 'o':
		if oleg[min_oleg_id] < igor[max_igor_id]:
			ans[l_ans] = oleg[min_oleg_id]
			l_ans += 1
			min_oleg_id += 1
		else:
			ans[r_ans] = oleg[max_oleg_id]
			r_ans += -1
			max_oleg_id += -1
		curr_turn = 'i'
	else:
		if igor[max_igor_id] > oleg[min_oleg_id]:
			ans[l_ans] = igor[max_igor_id]
			l_ans += 1
			max_igor_id += -1
		else:
			ans[r_ans] = igor[min_igor_id]
			r_ans += -1
			min_igor_id += 1
		curr_turn = 'o'
strans = ''.join(ans)
print(strans)


import sys
import math
from collections import defaultdict, deque
import heapq
oleg = list(sys.stdin.readline()[:-1])
igor = list(sys.stdin.readline()[:-1])
oleg.sort()
igor.sort()
igor.reverse()
n = len(oleg)
ans = [0 for _ in range(n)]
(cnto, cnti) = (n // 2 + n % 2, n // 2)
(indo, indi) = (0, 0)
ind = 0
oleg = oleg[:cnto]
igor = igor[:cnti]
igor.reverse()
(sto, endo) = (0, len(oleg) - 1)
(sti, endi) = (0, len(igor) - 1)
turn = True
(indst, indend) = (0, n - 1)
while indst <= indend and sto <= endo and (sti <= endi):
	if turn:
		if oleg[sto] < igor[endi]:
			ans[indst] = oleg[sto]
			sto += 1
			indst += 1
		else:
			ans[indend] = oleg[endo]
			endo -= 1
			indend -= 1
		turn = False
	else:
		if igor[endi] > oleg[sto]:
			ans[indst] = igor[endi]
			endi -= 1
			indst += 1
		else:
			ans[indend] = igor[sti]
			sti += 1
			indend -= 1
		turn = True
if sto <= endo and indst <= indend:
	ans[indst] = oleg[sto]
	indst += 1
if sti <= endi and indst <= indend:
	ans[indst] = igor[sti]
print(''.join((x for x in ans)))


import sys
import heapq
import math
a = []
b = []

def read_line(arr):
	while True:
		c = sys.stdin.read(1)
		if c == '\n' or c == '':
			break
		heapq.heappush(arr, c)
read_line(a)
read_line(b)
n = len(a)
a = heapq.nsmallest(math.ceil(n / 2), a)
b = heapq.nlargest(math.floor(n / 2), b)
s = []
r = []
left = [0, 0]
right = [-1, -1]
for i in range(n):
	turn = i % 2
	arr = a if turn == 0 else b
	if i == n - 1 or a[left[0]] < b[left[1]]:
		print(arr[left[turn]], end='')
		left[turn] += 1
	else:
		r.append(arr[right[turn]])
		right[turn] -= 1
for i in range(len(r)):
	print(r[~i], end='')


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
s = list(input())
n1 = len(s)
t = list(input())
s.sort()
t.sort(reverse=True)
s = s[:int(math.ceil(n1 / 2))]
t = t[:n1 // 2]
cou = 0
cou1 = len(s) - 1
cou2 = 0
cou3 = len(t) - 1
cou4 = 0
cou5 = n1 - 1
ans = [''] * n1
tw = 0
n = n1
for i in range(n):
	if i == n - 1 and n % 2 == 1:
		ans[cou4] = s[cou]
		cou4 += 1
		cou += 1
	elif i == n - 1 and n % 2 == 0:
		ans[cou4] = t[cou2]
		cou4 += 1
		cou2 += 1
	elif tw % 2 == 0:
		if s[cou] >= t[cou2]:
			ans[cou5] = s[cou1]
			cou5 -= 1
			cou1 -= 1
		else:
			ans[cou4] = s[cou]
			cou4 += 1
			cou += 1
	elif t[cou2] <= s[cou]:
		ans[cou5] = t[cou3]
		cou5 -= 1
		cou3 -= 1
	else:
		ans[cou4] = t[cou2]
		cou4 += 1
		cou2 += 1
	tw = 1 - tw
print(*ans, sep='')


from operator import lt, gt
s = [sorted(input()), sorted(input(), reverse=True)]
n = len(s[0])
idx = [[0, (n >> 1) + (n & 1) - 1], [0, (n >> 1) - 1]]
op = [lt, gt]
(l, r) = (0, n - 1)
ans = ['*'] * n
for i in range(n):
	p = i & 1
	if op[p](s[p][idx[p][0]], s[p ^ 1][idx[p ^ 1][0]]):
		ans[l] = s[p][idx[p][0]]
		l += 1
		idx[p][0] += 1
	else:
		ans[r] = s[p][idx[p][1]]
		r -= 1
		idx[p][1] -= 1
print(*ans, sep='')


s = list(map(str, input()))
c = list(map(str, input()))
n = len(s)
s.sort()
c.sort(reverse=True)
s = s[:(n + 1) // 2]
c = c[:n // 2]
l_s = len(s)
l_c = len(c)
begin_s = 0
begin_c = 0
end_s = l_s - 1
end_c = l_c - 1
ans1 = []
ans2 = []
for i in range(n - 1):
	if i % 2 == 0:
		if s[begin_s] >= c[begin_c]:
			ans2.append(s[end_s])
			end_s -= 1
		else:
			ans1.append(s[begin_s])
			begin_s += 1
	elif c[begin_c] <= s[begin_s]:
		ans2.append(c[end_c])
		end_c -= 1
	else:
		ans1.append(c[begin_c])
		begin_c += 1
if n % 2:
	ans1.append(s[begin_s])
else:
	ans1.append(c[begin_c])
print(*ans1 + list(reversed(ans2)), sep='')


from sys import *
f = lambda : sorted(stdin.readline()[:-1])
t = [f()[::-1], f()]
n = len(t[0])
p = [n & 1, 1]
s = ''
for i in range(n):
	k = t[0][-1] < t[1][-1]
	p[k] ^= 1
	s += t[p[k]].pop()
print(s)


s1 = list(input())
s2 = list(input())
s1.sort()
s2.sort(reverse=True)
n = len(s1)
s = ['?'] * n
(i, j, ni, nj) = (0, 0, (n + 1) // 2 - 1, n // 2 - 1)
(front, rear) = (0, n - 1)
for cur in range(n):
	if cur & 1 == 0:
		if s1[i] < s2[j]:
			s[front] = s1[i]
			i += 1
			front += 1
		else:
			s[rear] = s1[ni]
			ni -= 1
			rear -= 1
	elif s1[i] < s2[j]:
		s[front] = s2[j]
		j += 1
		front += 1
	else:
		s[rear] = s2[nj]
		nj -= 1
		rear -= 1
print(''.join(s))


from sys import stdin, stdout

def rint():
	return map(int, stdin.readline().split())
a = list(input())
b = list(input())
a.sort()
b.sort(reverse=True)
n = len(a)
ans = ['' for i in range(n)]
ai = 0
bi = 0
aj = 0
bj = 0
aiend = n // 2 - 1
if n % 2:
	aiend += 1
biend = n // 2 - 1
i = 0
j = 0
flag = 0
while i + j < n:
	if i + j < n:
		if a[ai] < b[bi] and flag == 0:
			ans[i] = a[ai]
			i += 1
			ai += 1
		else:
			ans[n - j - 1] = a[aiend - aj]
			j += 1
			aj += 1
			flag = 1
	if i + j < n:
		if a[ai] < b[bi] and flag == 0:
			ans[i] = b[bi]
			i += 1
			bi += 1
		else:
			ans[n - j - 1] = b[biend - bj]
			j += 1
			bj += 1
			flag = 1
print(''.join(ans))