#include <bits/stdc++.h>
using namespace std;
char a[100010], s[100010];
bool comp(char a, char b) { return a > b; }
int main() {
  long long cs, t, i, j, k, x, y, z, ans, q, m, n;
  while (scanf("%s", a) != EOF) {
    scanf("%s", s);
    sort(s, s + strlen(s), comp);
    i = 0;
    j = 0;
    x = strlen(a);
    y = strlen(s);
    while (i < x && j < y) {
      if (a[i] < s[j]) {
        a[i] = s[j];
        i++;
        j++;
      } else
        i++;
    }
    printf("%s\n", a);
  }
  return 0;
}
