#include <bits/stdc++.h>
using namespace std;
int main() {
  long mas_1[11], i, a, b, n, j;
  string s1, s2;
  for (i = 0; i <= 10; i++) mas_1[i] = 0;
  cin >> s1;
  cin >> s2;
  for (i = 0; i < s2.length(); i++)
    if ((int)(s2[i]) - (int)('0') > -1 && (int)(s2[i]) - (int)('0') < 11)
      (mas_1[(int)(s2[i]) - (int)('0')])++;
  for (i = 0; i < s1.length(); i++)
    for (j = 10; j >= 0; j--) {
      if (((int)(s1[i]) - (int)('0') < j) && (mas_1[j] > 0)) {
        s1[i] = (char)(j + (int)('0'));
        (mas_1[j])--;
      }
    }
  cout << s1 << endl;
  return 0;
}
