#include <bits/stdc++.h>
using namespace std;
bool SortbySecDesc(const pair<long long, long long> &a,
                   const pair<long long, long long> &b) {
  return a.second > b.second;
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  ;
  string s, s1;
  cin >> s >> s1;
  sort(s1.begin(), s1.end());
  long long len = s1.size();
  int j = len - 1;
  for (int i = 0; i < s.size(); i++) {
    if (s1[j] > s[i]) {
      s[i] = s1[j];
      j--;
      if (j < 0) break;
    }
  }
  cout << s << "\n";
  ;
  return 0;
}
