#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b;
  cin >> a >> b;
  sort(b.begin(), b.end());
  int rep = 0;
  int n = a.length();
  reverse(b.begin(), b.end());
  int j = 0;
  int m = b.length();
  for (int i = 0; i < n && j < m; i++) {
    if (b[j] > a[i]) {
      a[i] = b[j];
      j++;
      rep++;
    }
  }
  cout << a << endl;
  return 0;
}
