#include<iostream>
#include<string>
using namespace std;
int main()
{
int n,b[40];
string s1,s2;
char link[40];
while(scanf("%d",&n)!=EOF)
{
cin>>s1>>s2;
link[0]='0';
int top=0,j=0,k=0,u=0;
do
{
if (j<n)
{
top++;
link[top]=s1[j];
b[u++]=1;
}
if(link[top]==s2[k])
{
do{
top--;
b[u++]=0;
k++;
if (j==n-1&&top==0) break;
}while (link[top]==s2[k]);
}
if (j==n-1&&top==0) break;
if(j==n-1&&link[top]!=s2[k])break;
if (j<n-1&&link[top]!=s2[k]) j++;
}while(1);
if (top==0)
{
cout<<"Yes."<<endl;
for(int j=0;j<u;j++)
if(b[j])cout<<"in"<<endl;
else cout<<"out"<<endl;
cout<<"FINISH"<<endl;
}else
{
cout<<"No."<<endl;
cout<<"FINISH"<<endl;
}
}
return 0;
}
杭电ACM1022
最新推荐文章于 2017-11-20 00:23:49 发布