#include <bits/stdc++.h>
using namespace std;
int main() {
  string x, y;
  char temp;
  cin >> x >> y;
  sort(y.begin(), y.end(), greater<int>());
  for (int i = 0, j = 0; i < y.length() && j < x.length(); i++, j++) {
    if (y[i] > x[j]) {
      temp = y[i];
      y[i] = x[j];
      x[j] = temp;
    } else
      i--;
  }
  cout << x << "\n";
}
