#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, a;
  cin >> a >> s;
  sort((s).rbegin(), (s).rend());
  int indice = 0;
  for (int i = 0; i < a.length() && indice < s.length(); i++)
    if (a[i] < s[indice]) a[i] = s[indice++];
  cout << a << endl;
  return 0;
}
