#include<iostream>
#include<
string>
#include<stack>
using namespace std;
int main ()
{
int n,i,j,c;
int d[
100];
string a,b;
while(cin>>n>>a>>
b)
{
i=j=c=
0;
stack<
int>
st;
int tag=
1;
while(j<
n)
{
if(a[i]==
b[j])
{
i++
;
j++
;
d[c++]=
1;
d[c++]=
0;
}
else if(!st.empty()&&st.top()==
b[j])
{
d[c++]=
0;
st.pop();
j++
;
}
else if(i<
n)
{
d[c++]=
1;
st.push(a[i]);
i++
;
}
else
{
tag=
0;
break;
}
}
if(tag==
1)
{
cout<<
"Yes."<<
endl;
for(i=
0;i<c;i++
)
{
if(d[i]==
1)
cout<<
"in"<<
endl;
else cout<<
"out"<<
endl;
}
}
else cout<<
"No."<<
endl;
cout<<
"FINISH"<<
endl;
}
return 0;
}
转载于:https://www.cnblogs.com/LK1994/archive/2013/03/22/2976270.html
相关资源:JAVA上百实例源码以及开源项目
转载请注明原文地址: https://mac.8miu.com/read-54784.html