while True:
    try:
        # 第一步
        s = ''.join(input().split())
        # 第二步
        l1 = [s[i] for i in range(len(s)) if i % 2 == 0] # 下标偶数
        l2 = [s[i] for i in range(len(s)) if i % 2 > 0] # 下标奇数
        l1, l2 = sorted(l1), sorted(l2) # 排序
        i = 1
        for c in l2:
            l1.insert(i, c) # 插入下标为奇数的字符
            i += 2
        s = ''.join(l1)
        # 第三步
        res = ''
        for c in s:
            if c in '0123456789abcdefABCDEF':
                b = bin(int(c, 16)).replace('0b', '')
                if len(b) < 4:
                    b = '0'*(4-len(b)) + b
                r = b[::-1]
                res += hex(int(r, 2)).replace('0x', '').upper()
            else:
                res += c
        print(res)
    except:
        break