#include <bits/stdc++.h>
using namespace std;
int main() {
  string str, str2;
  while (cin >> str) {
    cin >> str2;
    sort(str2.begin(), str2.end());
    int j = str2.size() - 1;
    for (int i = 0; i < str.size(); i++) {
      if (j < 0) break;
      if (str2[j] > str[i]) {
        str[i] = str2[j];
      } else
        j++;
      j--;
    }
    cout << str << endl;
  }
  return 0;
}
