str1, str2 = input().split() # 0.合并 s = str1 + str2 # 1.分离出奇偶序号字母 s_even = [] s_odd = [] for i in range(len(s)): if i % 2 == 0: s_even.append(s[i]) else: s_odd.append(s[i]) # 2.排序 s_even.sort() s_odd.sort() # 3.构造新字符串 ns = "" for i in range(len(s) // 2): ns += s_even[i] + s_odd[i] if len(s)%2 != 0:# 长度为奇数则再添加s_even最后一个元素 ns += s_even[-1] # 4.进制转换 res = "" for i in ns: if 48 <= ord(i) <= 57 or 65 <= ord(i) <= 70 or 97 <= ord(i) <= 102: res += hex(int(bin(int(i, 16))[2:].rjust(4,'0')[::-1], 2))[2:].upper() else: res += i print(res)