#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j;
  char a[100005], b[100005];
  scanf("%s%s", a, b);
  n = strlen(b), k = strlen(a);
  sort(b, b + n);
  reverse(b, b + n);
  for (i = 0, j = 0; i < n && j < k; i++, j++) {
    if (b[i] > a[j])
      a[j] = b[i];
    else if (b[i] <= a[j])
      i--;
  }
  printf("%s", a);
}
