#include <bits/stdc++.h>
using namespace std;
int main() {
  string reem, mahmoud;
  cin >> reem >> mahmoud;
  sort(mahmoud.begin(), mahmoud.end(), greater<int>());
  for (int i = 0, j = 0; i < (int)reem.size(); ++i) {
    if (reem[i] < mahmoud[j]) {
      reem[i] = mahmoud[j];
      ++j;
    }
  }
  cout << reem << endl;
}
