#include <bits/stdc++.h>
using namespace std;
const long double Pi = 3.141592653;
const long long mod = 1e9 + 7;
bool cmp(pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first) || (a.first == b.first && a.second > b.second);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    string a, s;
    cin >> a >> s;
    sort(s.rbegin(), s.rend());
    int j = 0;
    for (int i = 0; i < a.length(); i++) {
      if (j < s.length()) {
        if (a[i] < s[j]) swap(a[i], s[j]), j++;
      }
    }
    cout << a;
  }
}
