#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
// 处理 0-9、a-f、A-F 的转化
static char transfromChar(char c) {
int num = 0, sum = 0;
if (isdigit(c)) num = c - '0';
else if (islower(c)) num = c - 'a' + 10;
else if (isupper(c)) num = c - 'A' + 10;
// 翻转
// 第 1 位 左移 3 到第 4位
sum += ((num & 1 ) << 3);
// 第 2 位 左移 1 到第 3位
sum += ((num & 2) << 1);
// 第 3 位 右移 1 到第 2位
sum += ((num & 4) >> 1);
// 第 4 位 右移 3 到第 1位
sum += ((num & 8) >> 3);
// 得到的 sum 为 十进制,转化为 16进制 数字或字母;
if (sum < 10)
return sum + '0';
else
return (sum - 10) + 'A';
}
int main() {
string line;
getline(cin, line);
string u;
// 合并字符串
// 移除空格;
line.erase(remove(line.begin(), line.end(), ' '), line.end());
// 排序 获得 u′
for (int i = 0; i < line.size(); i++) {
for (int j = i + 2; j < line.size(); j = j + 2) {
if (line[i] > line[j]) {
char c = line[i];
line[i] = line[j];
line[j] = c;
}
}
}
//cout << "u'=" << line << endl;
// 最后一步 翻转 + 输出大写字母
for (auto c : line) {
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' &&
c <= 'F')) {
cout << transfromChar(c);
} else {
cout << c;
}
}
cout << endl;
return 0;
}