#include <bits/stdc++.h>
using namespace std;
string a;
string s;
int main() {
  cin >> a >> s;
  sort(s.rbegin(), s.rend());
  for (int i = 0, j = 0; i < a.size(); i++) {
    int ins = s[j] - '0';
    int ina = a[i] - '0';
    if (ina < ins && j < s.size()) {
      a[i] = s[j++];
    }
  }
  cout << a << endl;
  return 0;
}
