#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int ST = 100010;
const int ST1 = 1000010;
const long long MOD = 1000000007;
long long ABS(long long a) {
  if (a < 0)
    return a * (-1);
  else
    return a;
}
int main() {
  string a;
  string b;
  cin >> a;
  cin >> b;
  sort(b.begin(), b.end());
  reverse(b.begin(), b.end());
  int n = (int)((a).size());
  int m = (int)((b).size());
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (j < m && a[i] < b[j]) {
      a[i] = b[j];
      j++;
    }
  }
  cout << a;
}
