#include <bits/stdc++.h>
using namespace std;
int cmb(int a, int b) {
  if (a != b) {
    return a > b;
  }
}
int main() {
  vector<int> vc;
  string a, s;
  cin >> a >> s;
  for (int i = 0; i < s.size(); i++) {
    vc.push_back(s[i] - '0');
  }
  sort(vc.begin(), vc.end(), cmb);
  int j = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] < (vc[j] + '0')) {
      a[i] = (vc[j] + '0');
      vc[j] == 0;
      ++j;
    }
    if (j == vc.size()) {
      break;
    }
  }
  cout << a;
  return 0;
}
