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