#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s;
  cin >> a >> s;
  sort((s).begin(), (s).end());
  reverse((s).begin(), (s).end());
  int ptr = 0;
  for (long long i = 0; i < a.size(); i++) {
    if (ptr == s.size()) break;
    if (a[i] < s[ptr]) a[i] = s[ptr++];
  }
  cout << a << "\n";
  return 0;
}
