#include <bits/stdc++.h>
#pragma hdrstop
#pragma argsused
using namespace std;
int main(int argc, char* argv[]) {
  string a, b;
  cin >> a >> b;
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  for (int i = 0, j = 0; i < b.length() && j < a.length(); i++) {
    while (j < a.length() && b[i] <= a[j]) j++;
    if (j < a.length() && b[i] > a[j]) a[j] = b[i];
  }
  cout << a;
  return 0;
}
