#include <bits/stdc++.h>
using namespace std;
struct triple {
  long long x = 0;
  long long y = 0;
  long long z = 0;
  void mt(long long a, long long b, long long c) {
    x = a;
    y = b;
    z = c;
  }
  void holify() {
    x = 69;
    y = 420;
    z = 911;
  }
};
bool srt(pair<char, int> a, pair<char, int> b) { return a.second < b.second; }
int main() {
  string a, b;
  cin >> a >> b;
  sort(b.begin(), b.end());
  for (int i = 0; i < a.size() && b.size(); i++) {
    if (b.back() > a[i]) {
      a[i] = b.back();
      b.pop_back();
    }
  }
  cout << a;
}
