题目:​​http://acm.hdu.edu.cn/showproblem.php?pid=1022​

#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
int main()
{
char s2[1010],s1[1010];
int pass[1010];
int n;
while(scanf("%d",&n)!=EOF)
{
stack<char> s;
memset(s2,0,sizeof(s2));
memset(s1,0,sizeof(s1));
memset(pass,0,sizeof(pass));
scanf("%s%s",s1,s2);
for(int i=0,k=0,j=0;i<strlen(s1);i++)
{
s.push(s1[i]);
pass[k++]=1;
while(!s.empty()&&s.top()==s2[j])
{
pass[k++]=2;
j++;
s.pop();
}
}
if(s.empty())
{
printf("Yes.\n");
for(int i=0;pass[i]!=0;i++)
{
if(pass[i]==1)
printf("in\n");
if(pass[i]==2)
printf("out\n");
}
}
else
printf("No.\n");
printf("FINISH\n");
}
return 0;
}