#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string str, str2;
  long long int l, counter = 0, ara[100005], l2, i, n, j;
  cin >> str >> str2;
  l = str2.size();
  l2 = str.size();
  for (i = 0; i < l; i++) {
    ara[i] = str2[i] - 48;
  }
  sort(ara, ara + l, greater<long long int>());
  for (i = 0, j = 0; i < l2 && j < l; i++) {
    if (str[i] < ara[j] + 48) {
      str[i] = ara[j] + 48;
      j++;
    }
  }
  cout << str << endl;
}
