#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;
void swap(long long a, long long b) {
  int temp = a;
  a = b;
  b = temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s1, s2;
  cin >> s1 >> s2;
  sort(s2.rbegin(), s2.rend());
  int itr = 0;
  for (int i = 0; i < (int)s1.length(); i++) {
    if (s1[i] < s2[itr]) {
      s1[i] = s2[itr];
      itr++;
    }
  }
  cout << s1;
}
