#include <bits/stdc++.h>
using namespace std;
char s[100005], x[100005];
int cmp(char c, char q) { return c > q; }
int main() {
  int i, j;
  cin >> s >> x;
  int len1 = strlen(s);
  int len2 = strlen(x);
  sort(x, x + len2, cmp);
  j = 0;
  for (i = 0; i < len2; i++) {
    if (x[i] == '0') break;
    if (j == len1) break;
    if (x[i] > s[j])
      s[j++] = x[i];
    else {
      j++;
      i--;
    }
  }
  cout << s;
  return 0;
}
