栈的应用水题,,
#include<string>
#include<stack>
#include<string.h>
#include<iostream>
using namespace std;
string a[20];
int main()
{
int n;
string s,s1;
while(cin>>n)
{ stack<char> Q;
cin>>s>>s1;
int i=0,j=0;
int tot=0;
bool ok=0;
while(j<n)
{
if(!Q.empty()&&Q.top()==s1[j])
{ a[++tot]="out";
Q.pop();j++;
}
else if(i<n) {
Q.push(s[i++]);
a[++tot]="in";
}
else {ok=1;break;}
}
if(ok) cout<<"No."<<endl<<"FINISH"<<endl;
else{
cout<<"Yes."<<endl;
for(int i=1;i<=tot;++i)
cout<<a[i]<<endl;
cout<<"FINISH"<<endl;
}
}return 0;
}