#include<stdio.h>
#include<string.h>
#include<stack>
using namespace std;
stack<char> str;
char s1[9],s2[9];
int main()
{
int n;
str.push(‘#‘);
while(~scanf("%d %s %s",&n,s1,s2))
{
while(str.top()!=‘#‘)
str.pop();
int l=0,i;
for(i=0;i<n;i++)
{
str.push(s1[i]);
if(str.top()==s2[l])
{
while(str.top()==s2[l])
{
str.pop();
l++;
}
}
}
if(str.top()==‘#‘)
{
printf("Yes.\n");
l=0;
for(i=0;i<n;i++)
{
if(str.top()!=s2[l])
{
str.push(s1[i]);
printf("in\n");
if(str.top()==s2[l])
{
while(str.top()==s2[l])
{
str.pop();
printf("out\n");
l++;
}
}
}
}
printf("FINISH\n");
}
else printf("No.\nFINISH\n");
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-07-31 14:34:40