#include<stdio.h>
#include<string.h>

char change(char ch)
{
    char cch;
    switch(ch)
    {
        case '0':cch='0';break;
        case '1':cch='8';break;
        case '2':cch='4';break;
        case '3':cch='C';break;
        case '4':cch='2';break;
        case '5':cch='A';break;
        case '6':cch='6';break;
        case '7':cch='E';break;
        case '8':cch='1';break;
        case '9':cch='9';break;
        case 'a':
        case 'A':cch='5';break;
        case 'b':
        case 'B':cch='D';break;
        case 'c':
        case 'C':cch='3';break;
        case 'd':
        case 'D':cch='B';break;
        case 'e':
        case 'E':cch='7';break;
        case 'f':
        case 'F':cch='F';break;
        default: cch=ch;break;
    }
    return cch;
}

int main()
{
    char str1[300];
    char str2[300];
    while(EOF != scanf("%s%s",str1,str2))
    {
        strcat(str1, str2);
        int len = strlen(str1);
        int i,j,k;
        char ch;
        for(i=0;i<len;i+=2)
            for(j=0;j<len;j+=2)
            {
                if( (j<len)&&(j+2)<len && str1[j] > str1[j+2])
                {
                    ch = str1[j];
                    str1[j] = str1[j+2];
                    str1[j+2] = ch;
                }
            }
        
        for(i=1;i<len;i+=2)
            for(j=1;j<len;j+=2)
            {
                if((j<len)&&(j+2)<len && (str1[j] > str1[j+2]))
                {
                    ch = str1[j];
                    str1[j] = str1[j+2];
                    str1[j+2] = ch;
                }
            }
        
        for(int i=0;i<len;i++)
        {
            if( (str1[i] >= '0' && str1[i] <='9')  ||  (str1[i]>='A' && str1[i]<='F') ||  (str1[i] >= 'a' && str1[i] <= 'f') )
            {
                str1[i] = change(str1[i]);
            }
        }
        
        printf("%s\n",str1);
    }
    
    return 0;
}