#include <iostream>
#include <cstring>
using namespace std;
int main(void) {
string str, substr;
while (cin >> str >> substr) {
int idx = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] > str[idx]) {
idx = i;
}
}
str.insert(idx + 1, substr);
cout << str << endl;
}
}