#include <bits/stdc++.h>
char a[100001], b[100001];
int comp(const void *p1, const void *p2) { return *(char *)p2 - *(char *)p1; }
int main() {
  int i, j, k, p;
  while (scanf("%s", a) != EOF) {
    p = 0;
    getchar();
    gets(b);
    k = strlen(b);
    qsort(b, k, sizeof(char), comp);
    for (i = 0; i < k; i++) {
      for (j = p; a[j] != '\0'; j++) {
        if (b[i] > a[j]) {
          a[j] = b[i];
          p = j + 1;
          break;
        }
      }
      if (a[j] == '\0') break;
    }
    printf("%s\n", a);
  }
  return 0;
}
