#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAX = 1000;
const int inf = 1000 * 1000 * 1000;
const int p1 = 104393321, p2 = 104393329;
bool cmp(char a, char b) { return a > b; }
int main(int argc, char **argv) {
  ios::sync_with_stdio(0);
  string n, m;
  cin >> n >> m;
  sort((m).begin(), (m).end(), cmp);
  int pos = 0;
  for (int i = (0); i < int(n.size()); ++i)
    if (pos < (int)m.size()) {
      if (n[i] < m[pos]) swap(n[i], m[pos++]);
    }
  cout << n << endl;
  return 0;
}
