#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, s;
  int c(0);
  cin >> a >> s;
  sort(s.begin(), s.end()), reverse(s.begin(), s.end());
  for (int i = 0; i < a.size(); i++) {
    if (a[i] < s[c]) a[i] = s[c++];
  }
  cout << a << endl;
}
