#include <bits/stdc++.h>
using namespace std;
string a, s;
bool cmp(char aa, char bb) { return aa > bb; }
int main() {
  cin >> a >> s;
  int i, j;
  int minm = INT_MAX;
  for (i = 0; i < a.size(); i++) {
    minm = min(minm, (int)a[i]);
  }
  sort(s.begin(), s.end(), cmp);
  if (s[0] < minm) {
    cout << a << endl;
    return 0;
  }
  j = 0;
  for (i = 0; i < a.size() && j < s.size(); i++) {
    if (a[i] < s[j]) {
      a[i] = s[j];
      j++;
    }
  }
  cout << a << endl;
  return 0;
}
