import re
while True:
    try:
        res = ''
        s = list(input().replace(' ',''))
        s[::2] = sorted(s[::2])  # 偶数升序
        s[1::2] = sorted(s[1::2])
        for i in s:
            if re.search(r'[0-9A-Fa-f]',i):
                num_10 = int(i,16)
                num_2 = (4 - len(str(bin(num_10))[2:])) * '0' + str(bin(num_10))[2:]
                num_2nx = num_2[::-1]
                num_10_2 = int(num_2nx,2)
                num_16 = hex(num_10_2)[2:].upper()
                res += num_16
            else:
                res += i
        print(res)
    except:
        break