//简单DFS
code:
#include<iostream>
#include<string>
#include<stack>
using namespace std;
string source,target;
char way[1000];
stack<char>word;
int len;
void DFS(int cnt,int in,int out)
{
if(out==len)
{
for(int i=0;i<cnt;i++) cout<<way[i]<<" ";
cout<<endl;
}
else if(in<len)
{
word.push(source[in]);
way[cnt]='i';
DFS(cnt+1,in+1,out);
word.pop();
}
char temp;
if(!word.empty() && (temp=word.top())==target[out])
{
word.pop();
way[cnt]='o';
DFS(cnt+1,in,out+1);
word.push(temp);
}
return ;
}
int main()
{
while(cin>>source>>target)
{
cout<<"[/n";
if(source.size()==target.size())
{
len=source.size();
DFS(0,0,0);
}
cout<<"]/n";
}
return 0;
}