← Home
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t;
    if (!(cin >> s >> t)) return 0;
    int n = (int)s.size();
 
    // Oleg's letters – ascending
    vector<char> o(s.begin(), s.end());
    sort(o.begin(), o.end());
 
    // Igor's letters – descending
    vector<char> i(t.begin(), t.end());
    sort(i.begin(), i.end(), greater<char>());
 
    int cntO = (n + 1) / 2;          // Oleg moves
    int cntI = n / 2;                // Igor moves
 
    vector<char> A(o.begin(), o.begin() + cntO);   // smallest cntO letters
    vector<char> B(i.begin(), i.begin() + cntI);   // largest cntI letters
 
    int aL = 0, aR = cntO - 1;
    int bL = 0, bR = cntI - 1;
 
    string ans(n, '?');
    int L = 0, R = n - 1;
    bool olegTurn = true;   // Oleg starts
 
    while (L <= R) {
        if (olegTurn) {                 // Oleg's move
            bool takeLeft = false;
            if (aL <= aR) {
                if (bL > bR)               // Igor has no letters left
                    takeLeft = true;
                else if (A[aL] < B[bL])    // his smallest beats Igor's biggest
                    takeLeft = true;
            }
            if (takeLeft) {
                ans[L++] = A[aL++];
            } else {
                ans[R--] = A[aR--];
            }
        } else {                         // Igor's move
            bool takeLeft = false;
            if (bL <= bR) {
                if (aL > aR)               // Oleg has no letters left
                    takeLeft = true;
                else if (A[aL] < B[bL])    // Oleg still has a smaller letter
                    takeLeft = true;
            }
            if (takeLeft) {
                ans[L++] = B[bL++];
            } else {
                ans[R--] = B[bR--];
            }
        }
        olegTurn = !olegTurn;
    }
 
    cout << ans << '\n';
    return 0;
}