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