bcdef
abbbc
 z
y
 reddit
abcdef
 abc
aaa
 y
z
 cbxz
aaaa

bccdb
 z
 dfdeed
 aab
 y
 abac

#include <bits/stdc++.h>
using namespace std;
int oleg[500];
int igor[500];
char olegs[300100];
char igors[300100];
char res[300100];
bool nogreater(int c) {
  int i;
  for (i = c + 1; i <= 122; i++)
    if (igor[i] == 1) return false;
  return true;
}
char getgreatestFromIgor() {
  int j;
  for (j = 122; j >= 97; j--) {
    if (igor[j] > 0) {
      igor[j]--;
      return (char)j;
    }
  }
}
int main() {
  cin >> olegs;
  cin >> igors;
  int len = strlen(olegs);
  int i;
  for (i = 0; i <= strlen(olegs); i++) {
    oleg[olegs[i]]++;
  }
  for (i = 0; i <= strlen(igors); i++) {
    igor[igors[i]]++;
  }
  int j;
  bool olegC = true;
  for (i = 1; i <= strlen(olegs); i++) {
    if (olegC == true) {
      for (j = 97; j <= 122; j++) {
        if (oleg[j] > 0) {
          if (nogreater(j) && (i + 1) <= len) {
            res[i + 1] = (char)j;
            oleg[j]--;
            res[i] = getgreatestFromIgor();
            i = i + 1;
            break;
          } else {
            res[i] = (char)j;
            oleg[j]--;
            olegC = false;
            break;
          }
        }
      }
    } else {
      for (j = 122; j >= 97; j--) {
        if (igor[j] > 0) {
          res[i] = (char)j;
          igor[j]--;
          break;
        }
      }
      olegC = true;
    }
  }
  cout << string(res + 1, res + 1 + strlen(olegs));
  return 0;
}
