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 main() {
  string s1, s2;
  cin >> s1 >> s2;
  sort(s1.begin(), s1.end());
  cout << s1 << endl;
  sort(s2.begin(), s2.end(), greater<int>());
  cout << s2 << endl;
  int flag = 1;
  for (int i = 0; i < s1.length(); i++)
    if (s1[i] < s2[i])
      flag = 2;
    else if (s1[i] > s2[i])
      flag = 1;
    else
      ;
  cout << "\n" << flag << endl;
  if (flag == 1) {
    int k = 0, p = 0;
    for (int i = 0; i < s1.length();) {
      if (i >= s1.length()) break;
      cout << s1[k++];
      i++;
      if (i >= s1.length()) break;
      cout << s2[p++];
      i++;
    }
  } else {
    int k = 0, p = 0;
    for (int i = 0; i < s1.length();) {
      if (i >= s1.length()) break;
      cout << s2[k++];
      i++;
      if (i >= s1.length()) break;
      cout << s1[p++];
      i++;
    }
  }
  return 0;
}
