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 O[27], P[27];
int main(void) {
  for (int i = 1; i <= 26; i++) {
    O[i] = 0;
    P[i] = 0;
  }
  char s1[300001], s2[300001];
  cin >> s1 >> s2;
  int len1 = strlen(s1), len2 = strlen(s2);
  for (int i = 1; i <= len1; i++) {
    int loc = s1[i - 1] - 'a' + 1;
    O[loc]++;
    loc = s2[i - 1] - 'a' + 1;
    P[loc]++;
  }
  int o = 1, p = 26;
  int t1 = 0, t2 = 0;
  char te;
  while (t1 + t2 < len1) {
    for (int j = o; j <= 26; j++) {
      if (O[j]) {
        te = 'a' + (j - 1);
        cout << te;
        t1++;
        O[j]--;
        o = j;
        break;
      }
    }
    if (t1 + t2 >= len1) {
      break;
    }
    for (int j = p; j >= 1; j--) {
      if (P[j]) {
        t2++;
        te = 'a' + (j - 1);
        cout << te;
        P[j]--;
        p = j;
        break;
      }
    }
  }
  cout << endl;
  return 0;
}
