#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <stack>
using namespace std;
const int MAXL = 10000000;
char s1[MAXL];
char s2[MAXL];
vector<char> ans;
stack<char> s;
int p1, p2, l; //p1->s1, p2->s2
void print()
{
//cout << "p1=" << p1 << ' ' << "p2=" << p2 << endl;
// cout << "size=" << s.size() <<endl;
printf("%c", ans[0]);
for (int i = 1; i < ans.size(); i++) {
printf(" %c", ans[i]);
}
printf("\n");
}
void dfs()
{
if (p2 == l) {
print();
}
// i
if (p1 < l) {
s.push(s1[p1]);
p1++;
ans.push_back('i');
dfs();
s.pop();
p1--;
ans.pop_back();
}
// o
if (p2 < l) {
if (s.empty()) return;
char ch = s.top();
if (ch != s2[p2]) return;
s.pop();
p2++;
ans.push_back('o');
dfs();
s.push(ch);
p2--;
ans.pop_back();
}
}
void solve()
{
ans.clear();
while (!s.empty()) {
s.pop();
}
printf("[\n");
l = strlen(s1);
int l2 = strlen(s2);
p1 = 0;
p2 = 0;
if (l == l2) dfs();
printf("]\n");
}
int main()
{
//freopen("in.txt", "r", stdin);
while (scanf("%s\n%s\n", s1, s2) != EOF) {
solve();
}
}