import sys
for line in sys.stdin:
    line = list(line[:-1].replace(' ',''))
    line[::2] = sorted(line[::2])
    line[1::2] = sorted(line[1::2])
    for i in range(len(line)):
        if line[i].isdecimal():
            line[i] = hex(int(bin(int(line[i]))[2:][::-1]+'0'*(6-len(bin(int(line[i])))),2))[2:].upper()
        elif line[i].isalpha() and line[i].upper() < 'G':
            line[i] = hex(int(bin(int(line[i].upper(),16))[2:][::-1],2))[2:].upper()
    print("".join(line))