#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s2;
  cin >> s >> s2;
  sort(s2.begin(), s2.end());
  int z = s2.length() - 1;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] < s2[z]) {
      s[i] = s2[z];
      z--;
    }
  }
  cout << s << endl;
  return 0;
}
