#include <bits/stdc++.h>
using namespace std;
char a[110000];
char b[110000];
int na[110000], nb[110000];
bool cmp(int a1, int a2) { return a1 > a2; }
int main() {
  while (cin >> a >> b) {
    int suma = 0;
    int lentha = strlen(a);
    for (int i = 0; i < lentha; i++) {
      na[i] = a[i] - '0';
      suma++;
    }
    int sumb = 0;
    int lengthb = strlen(b);
    for (int j = 0; j < lengthb; j++) {
      nb[j] = b[j] - '0';
      sumb++;
    }
    sort(nb, nb + sumb, cmp);
    int now = 0;
    for (int i = 0; i < suma; i++) {
      if (na[i] < nb[now]) {
        na[i] = nb[now];
        now++;
      }
      if (now >= sumb) break;
    }
    for (int i = 0; i < suma; i++) printf("%d", na[i]);
    cout << endl;
  }
  return 0;
}
