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