#include <bits/stdc++.h>
using namespace std;
char s[100004], a[100005];
bool cmp(char a, char b) { return a > b; }
int main() {
  scanf("%s%s", a, s);
  int lena = strlen(a);
  int lens = strlen(s);
  sort(s, s + lens, cmp);
  int j = 0;
  for (int i = 0; i < lena; i++) {
    if (s[j] > a[i]) {
      a[i] = s[j++];
    }
  }
  printf("%s", a);
  return 0;
}
