#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
struct Y {
  int fir, sec;
};
bool cmp(Y i, Y j) {
  if (i.fir != j.fir) return i.fir < j.fir;
  return i.sec < j.sec;
}
char a[100001], b[100001];
int main() {
  int la, lb;
  cin.getline(a, 100001);
  cin.getline(b, 100001);
  la = strlen(a);
  lb = strlen(b);
  sort(b, b + lb);
  int j = lb - 1;
  for (int i = 0; i < la; i++) {
    if (j >= 0 && a[i] < b[j]) {
      a[i] = b[j];
      j--;
    }
  }
  for (int i = 0; i < la; i++) cout << a[i];
  cout << endl;
  return 0;
}
