第一次用栈写出来了了;
#include<iostream>
using namespace std;
int stack[10];
string s[20];
int main()
{
int n;string a,b;
while(cin>>n>>a>>b)
{
int top=1,j=0,l=1;;
for(int i=0;i<n;i++)
{
stack[top]=a[i];
s[l++]="in";
while(stack[top]==b[j]&&j<n)
{
top--;
j++;
s[l++]="out";
}
top++;
}
if(j==n)
{
cout<<"Yes."<<endl;
for(int i=1;i<=l-1;i++)
{
cout<<s[i]<<endl;
}
cout<<"FINISH"<<endl;
}
else
{
cout<<"No."<<endl;
cout<<"FINISH"<<endl;
}
}
return 0;
}