#include <bits/stdc++.h>
using namespace std;
string s;
string a;
int main() {
  cin >> s >> a;
  int n = s.size(), m = a.size();
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int j = 0;
  for (int i = 0; i < m; i++) {
    int done = false;
    while (!done && j < n) {
      if (s[j] < a[i]) {
        done = true;
        s[j] = a[i];
        j++;
      } else {
        j++;
      }
    }
  }
  cout << s << endl;
  return 0;
}
