#include <bits/stdc++.h>
using namespace std;
int main() {
  string a_, b_;
  cin >> a_ >> b_;
  sort(b_.begin(), b_.end());
  reverse(b_.begin(), b_.end());
  int n = a_.size();
  int ind = 0;
  int m = b_.size();
  for (int i = 0; i < n; i++) {
    if (ind > m) break;
    if (b_[ind] > a_[i]) a_[i] = b_[ind++];
  }
  for (int i = 0; i < n; i++) cout << a_[i];
  cout << endl;
  return 0;
}
