1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 int main()
6 {
7 int NUM,Len,i,j,k,sign,Top;
8 char str[10000],flat[10000],FLAT[10000],SIGN[10000];
9 while(scanf("%d",&NUM)!=EOF)
10 {
11 memset(flat,0,sizeof(flat));
12 memset(FLAT,0,sizeof(FLAT));
13 memset(FLAT,0,sizeof(FLAT));
14 getchar();
15 scanf("%s%s",flat,FLAT);
16 for(i=0,j=0,k=0,sign=0,Top=0;k<=NUM&&j<=NUM;)
17 {
18 if(Top>=0&&k>0&&str[Top]==FLAT[j])
19 {
20 str[Top]=‘\0‘;
21 Top-=1;k-=1;j++;
22 if(Top==0&&j>=NUM)break;
23 SIGN[sign++]=1;
24 }
25 else
26 {str[k++]=flat[i++];Top=k-1;SIGN[sign++]=0;}
27 str[k]=‘\0‘;
28 }
29 str[k]=‘\0‘;
30 if(str[0]==‘\0‘)
31 {
32 printf("Yes.\n");
33 for(i=0;i<sign-2;i++)
34 if(SIGN[i]==0)
35 printf("in\n");
36 else if(SIGN[i]==1)
37 printf("out\n");
38
39 }
40 else
41 printf("No.\n");
42 printf("FINISH\n");
43 }
44
45
46
47 }