#include <iostream> #include <stdio.h> #include <string> #include <string.h> #include <algorithm> #include <math.h> #include <fstream> #include <vector> #include <map> #include <queue> #include <stack> #include <math.h> #include <stdlib.h> using namespace std ; string origion,target; stack<char>build; vector<char>operate; int length; void dfs(int ipush,int ipop){ if(ipush == length&&ipop == length){ for(int i = 0;i < operate.size();i++) cout<<operate[i]<<" "; cout<<endl; } if(ipush+1<=length){ build.push(origion[ipush]); operate.push_back('i'); dfs(ipush+1,ipop); build.pop(); operate.pop_back(); } if(ipop+1 <= ipush && ipop+1 <= length && build.top() == target[ipop]){ char temp = build.top(); build.pop(); operate.push_back('o'); dfs(ipush,ipop+1); build.push(temp); operate.pop_back(); } } int main(){ while(cin>>origion>>target){ length = origion.size(); cout<<"["<<endl; dfs(0,0); cout<<"]"<<endl; } return 0 ; }