#include <bits/stdc++.h>
using namespace std;
string s1, s2;
int main() {
  cin >> s1 >> s2;
  sort(s2.begin(), s2.end());
  for (int i = 0; i < s1.size() && s2.size(); i++)
    if (s2[s2.size() - 1] > s1[i]) {
      s1[i] = s2[s2.size() - 1];
      s2 = s2.substr(0, s2.size() - 1);
    }
  cout << s1 << endl;
  return 0;
}
