#include <bits/stdc++.h>
using namespace std;
string A, S;
int tonum(char c) { return c - '0'; }
int main() {
  cin >> A >> S;
  sort(S.rbegin(), S.rend());
  int i = 0, j = 0;
  while (i < A.size() && j < S.size()) {
    if (tonum(A[i]) < tonum(S[j])) {
      A[i] = S[j];
      i++;
      j++;
    } else
      i++;
  }
  cout << A << endl;
  return 0;
}
