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