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