#include <bits/stdc++.h>
using namespace std;
void solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string A, B;
  cin >> A >> B;
  int n = A.size();
  sort(B.begin(), B.end());
  for (int i = 0; i < n && (!B.empty()); ++i) {
    if (A[i] < B.back()) {
      A[i] = B.back();
      B.pop_back();
    }
  }
  cout << A << "\n";
  return 0;
}
