#include <bits/stdc++.h>
using namespace std;
map<string, int> pr;
bool cmp(string a, string b) {
  if (a.size() == b.size()) {
    for (int i = 0; i < b.size(); i++) {
      if (a[i] != b[i]) return a[i] > b[i];
    }
  } else if (a.size() > b.size())
    return 1;
  return 0;
}
bool sr(char s1, char s2) { return s1 > s2; }
int main() {
  string a, s;
  cin >> a >> s;
  sort(s.begin(), s.end(), sr);
  int j = 0;
  for (int i = 0; i < a.size(); i++) {
    if (s[j] != '-') {
      if (a[i] < s[j]) a[i] = s[j], s[j] = '-', j++;
    }
  }
  printf("%s\n", a.c_str());
  return 0;
}
