#include <iostream>
#include <cstring>
using namespace std;
const int TEN = 10;
bool isDigit(char c) {
return '0' <= c && c <= '9';
}
void countDigits(int fr[], char text[]) {
int textLen = strlen(text);
for (int i = 0; i < textLen; ++i) {
if (isDigit(text[i])) {
++fr[text[i] - '0'];
}
}
}
int constructNum(int fr[]) {
int biggerNum = 0;
for (int i = TEN - 1; i >= 0; --i) {
for (int j = 1; j <= fr[i]; ++j) {
biggerNum = biggerNum * TEN + i;
}
}
return biggerNum;
}
int biggerNumber(char text[]) {
int fr[TEN] = {0};
countDigits(fr, text);
return constructNum(fr);
}
int main() {
char text[100];
cin >> text;
cout << biggerNumber(text);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGludCBURU4gPSAxMDsKCmJvb2wgaXNEaWdpdChjaGFyIGMpIHsKICAgIHJldHVybiAnMCcgPD0gYyAmJiBjIDw9ICc5JzsKfQoKdm9pZCBjb3VudERpZ2l0cyhpbnQgZnJbXSwgY2hhciB0ZXh0W10pIHsKICAgIGludCB0ZXh0TGVuID0gc3RybGVuKHRleHQpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCB0ZXh0TGVuOyArK2kpIHsKICAgICAgICBpZiAoaXNEaWdpdCh0ZXh0W2ldKSkgewogICAgICAgICAgICArK2ZyW3RleHRbaV0gLSAnMCddOwogICAgICAgIH0KICAgIH0KfQoKaW50IGNvbnN0cnVjdE51bShpbnQgZnJbXSkgewogICAgaW50IGJpZ2dlck51bSA9IDA7CiAgICBmb3IgKGludCBpID0gVEVOIC0gMTsgaSA+PSAwOyAtLWkpIHsKICAgICAgICBmb3IgKGludCBqID0gMTsgaiA8PSBmcltpXTsgKytqKSB7CiAgICAgICAgICAgIGJpZ2dlck51bSA9IGJpZ2dlck51bSAqIFRFTiArIGk7CiAgICAgICAgfQogICAgfQogICAgcmV0dXJuIGJpZ2dlck51bTsKfQoKaW50IGJpZ2dlck51bWJlcihjaGFyIHRleHRbXSkgewogICAgaW50IGZyW1RFTl0gPSB7MH07CiAgICBjb3VudERpZ2l0cyhmciwgdGV4dCk7CiAgICByZXR1cm4gY29uc3RydWN0TnVtKGZyKTsKfQoKaW50IG1haW4oKSB7CiAgICBjaGFyIHRleHRbMTAwXTsKICAgIGNpbiA+PiB0ZXh0OwogICAgY291dCA8PCBiaWdnZXJOdW1iZXIodGV4dCk7CiAgICByZXR1cm4gMDsKfQ==