#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MXN = 1e5 + 7;
string s, t;
int cur, m, l, r;
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '|') m = i;
  l = m;
  r = s.length() - l - 1;
  cin >> t;
  if (t.length() < abs(r - l))
    cout << "Impossible";
  else if ((t.length() - abs(r - l)) % 2 == 1)
    cout << "Impossible";
  else {
    int a = (t.length() - abs(r - l)) / 2;
    int b = (t.length() - abs(r - l)) / 2;
    if (l > r)
      b += (l - r);
    else
      a += (r - l);
    for (int i = 0; i < m; i++) cout << s[i];
    for (int i = 0; i < a; i++) cout << t[cur++];
    cout << '|';
    for (int i = m + 1; i < s.length(); i++) cout << s[i];
    for (int i = 0; i < b; i++) cout << t[cur++];
  }
  return 0;
}
