#include <stdio.h>
#include <string.h>
void stepthree(char *c) {
int num;
if(*c >= '0' && *c <= '9') {
num = *c - '0';
} else if (*c >= 'a' && *c <= 'f') {
num = *c - 'a' + 10;
} else if (*c >= 'A' && *c <= 'F') {
num = *c - 'A' + 10;
} else {
return;
}
// printf("转换后的十进制数是%d\n", num);
int binary[4];
for(int i = 0; i < 4; i++) {
binary[i] = num % 2;
num /= 2;
}
int newnum = 0;
for(int i = 0; i < 4; i++) {
newnum = newnum * 2 + binary[i];
}
if(newnum >= 0 && newnum <= 9) {
*c = newnum + '0';
} else if (newnum > 9 && newnum <= 15) {
*c = newnum - 10 + 'A';
}
}
int main() {
char str1[201], str2[101];
while (scanf("%s %s", str1, str2) != EOF) {
// 第一步
strcat(str1, str2);
// 第二步
int len = strlen(str1);
for(int i = 0; i < len; i = i + 2) {
if(i >= len) break;
for(int j = i + 2; j < len; j = j + 2) {
if(j >= len) break;
if(str1[j] < str1[i]) {
int temp = str1[j];
str1[j] = str1[i];
str1[i] = temp;
}
}
}
for(int i = 1; i < len; i = i + 2) {
if(i >= len) break;
for(int j = i + 2; j < len; j = j + 2) {
if(j >= len) break;
if(str1[j] < str1[i]) {
int temp = str1[j];
str1[j] = str1[i];
str1[i] = temp;
}
}
}
// 第三步
for(int i = 0; i < len; i++) {
stepthree(&str1[i]);
}
printf("%s\n", str1);
}
return 0;
}