#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s;
  cin >> a >> s;
  sort(s.begin(), s.end());
  int ind = s.length() - 1, n = a.length();
  for (int i = 0; i < n; i++) {
    if (ind >= 0 && s[ind] > a[i]) {
      a[i] = s[ind];
      ind--;
    }
  }
  cout << a;
  return 0;
}
