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