#include <bits/stdc++.h>
using namespace std;
bool comp(const char& left, const char& right) { return right < left; }
int main() {
  vector<char> n, s;
  string temp;
  cin >> temp;
  n.resize(temp.size());
  for (size_t i = 0; i < temp.size(); i++) n[i] = temp[i];
  cin >> temp;
  s.resize(temp.size());
  for (size_t i = 0; i < temp.size(); i++) s[i] = temp[i];
  sort(s.begin(), s.end(), comp);
  size_t i = 0;
  size_t k = 0;
  while (i < n.size() && k < s.size()) {
    if (n[i] < s[k]) {
      n[i] = s[k];
      k++;
    }
    i++;
  }
  for (size_t i = 0; i < n.size(); i++) cout << n[i];
  return 0;
}
