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