#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string a, s;
  cin >> a >> s;
  sort(s.rbegin(), s.rend());
  int j = 0;
  for (int i = 0; i < a.size(); i++) {
    if (s[j] > a[i]) {
      a[i] = s[j];
      j++;
    }
  }
  cout << a;
}
