#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  string a, s;
  cin >> a >> s;
  sort(s.rbegin(), s.rend());
  for (size_t i = 0, j = 0; i < a.length(); ++i)
    if ((j < s.length()) && (s[j] > a[i])) a[i] = s[j++];
  cout << a;
  return 0;
}
