#include <bits/stdc++.h>
using namespace std;
string s, v;
int a[111111], i, j, n, m, k = 0, t;
int main() {
  cin >> s >> v;
  n = s.length();
  m = v.length();
  for (i = 0; i < m; i++) {
    a[i + 1] = int(v[i] - '0');
  }
  sort(a + 1, a + m + 1);
  t = m;
  for (i = 0; i < s.length(); i++) {
    if (int(s[i] - '0') < a[t]) {
      s[i] = char(a[t] + '0');
      t--;
    }
  }
  cout << s;
  return 0;
}
