#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s;
  char max;
  vector<char> v;
  cin >> a >> s;
  int i, j, sa, ss;
  sa = a.size();
  ss = s.size();
  for (i = 0; i < ss; i++) v.push_back(s[i]);
  sort(v.begin(), v.end());
  for (i = 0; i < sa; i++) {
    max = v[v.size() - 1];
    if (a[i] < max) {
      a[i] = max;
      v.pop_back();
    }
  }
  cout << a << endl;
  return 0;
}
