#include <bits/stdc++.h>
using namespace std;
int main() {
  int l, i, j;
  string string, ss;
  cin >> string >> ss;
  sort(ss.begin(), ss.end());
  reverse(ss.begin(), ss.end());
  ;
  l = string.size();
  ;
  j = 0;
  for (i = 0; i < l; i++) {
    if (string[i] < ss[j]) {
      string[i] = ss[j];
      j++;
    }
  }
  cout << string << endl;
  return 0;
}
