#include <bits/stdc++.h>
using namespace std;
char a[100005];
char s[100005];
int main() {
  gets(a);
  gets(s);
  int n = (int)strlen(a), m = (int)strlen(s);
  sort(s, s + m);
  reverse(s, s + m);
  int i = 0, j = 0;
  while (i < n && j < m) {
    if (a[i] < s[j]) {
      a[i] = s[j];
      i++;
      j++;
    } else
      i++;
  }
  cout << a << endl;
  return 0;
}
