#include <bits/stdc++.h>
using namespace std;
int n, m, p = 0;
char s[100001], a[100001];
int main() {
  scanf("%s\n%s", &a, &s);
  n = strlen(a);
  m = strlen(s);
  sort(s, s + m);
  reverse(s, s + m);
  for (int i = 0; i < n; ++i) {
    if (p >= m) break;
    if (a[i] < s[p]) {
      a[i] = s[p];
      ++p;
    }
  }
  printf(a);
  return 0;
}
