#include <bits/stdc++.h>
using namespace std;
vector<long long> A;
long long B[1000000] = {0};
bool cmp(long long x, long long y) { return x > y; }
int main() {
  A.clear();
  string S1, S2;
  cin >> S1;
  for (long long i = 0; i < S1.size(); i++) A.push_back(S1[i] - '0');
  cin >> S2;
  for (long long i = 0; i < S2.size(); i++) B[i] = S2[i] - '0';
  sort(B, B + S2.size(), cmp);
  long long find = 0;
  for (long long i = 0; i < A.size(); i++)
    if (A[i] < B[find]) A[i] = B[find++];
  for (long long i = 0; i < A.size(); i++) cout << A[i];
}
