标签:des style http io ar color os sp for



3 123 321 3 123 312
Yes. in in in out out out FINISH No. FINISHHint
#include<stdio.h>
//#include<iostream>
#include<stack>
using namespace std;
char a[11],b[11];
int main()
{
int n;
bool teg[11];
while(~scanf("%d",&n))
{
stack<char> ss;
int i,t,k;
scanf("%s",a);
scanf("%s",b);
t=0;k=0;
for(i=0;i<n;++i)
{
ss.push(a[i]);
teg[k++]=1;
while(!ss.empty()&&ss.top()==b[t])
{
t++;
ss.pop();
teg[k++]=0;
}
}
if(ss.empty()&&t==n)
{
printf("Yes.\n");
for(i=0;i<k;++i)
{
if(teg[i]==true)
printf("in\n");
else
printf("out\n");
}
printf("FINISH\n");
}
else
printf("No.\nFINISH\n");;
}
return 0;
}
//STL栈的应用:
push(x) 将x加入栈中,即入栈操作
pop() 出栈操作(删除栈顶),只是出栈,没有返回值
top() 返回第一个元素(栈顶元素)
size() 返回栈中的元素个数
empty() 当栈为空时,返回 true
标签:des style http io ar color os sp for
原文地址:http://blog.csdn.net/qq_18062811/article/details/41910021