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