#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  sort(b.rbegin(), b.rend());
  for (int i = 0, j = 0; i < a.size(); i++)
    if (j < b.size() && b[j] > a[i]) a[i] = b[j++];
  cout << a;
}
