#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string a, s;
  cin >> a >> s;
  int i, j, n = a.size(), m = s.size();
  sort(s.begin(), s.end());
  for (i = 0, j = m - 1; i < n && j >= 0; i++)
    if (a[i] < s[j]) a[i] = s[j--];
  cout << a;
}
