#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 pos = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] < s[pos]) {
      a[i] = s[pos];
      pos++;
      if (pos == s.size()) {
        break;
      }
    }
  }
  cout << a << endl;
  return 0;
}
