#include <bits/stdc++.h>
using namespace std;
char z[200009];
char s[300008], s1[3000008];
bool compare(char a, char b) { return a > b; }
int main() {
  int i, a, a1, k;
  cin >> s >> s1;
  a = strlen(s);
  a1 = strlen(s1);
  sort(s1, s1 + a1, greater<char>());
  for (i = 0, k = 0; i < a; i++) {
    if (k < a1 && s[i] < s1[k]) {
      s[i] = s1[k];
      k++;
    }
  }
  for (i = 0; i < a; i++) {
    if (s[i] != '0') break;
  }
  for (int j = i; j < a; j++) {
    cout << s[j];
  }
}
