#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
A cvt(B x) {
  stringstream ss;
  ss << x;
  A y;
  ss >> y;
  return y;
}
string a, s;
int main() {
  cin >> a >> s;
  sort(s.begin(), s.end());
  reverse(s.begin(), s.end());
  int j = 0;
  for (int i = 0; i < a.size(); i++) {
    if (j < s.size() && a[i] < s[j]) {
      a[i] = s[j];
      j++;
    }
  }
  cout << a << endl;
  return 0;
}
