首页 > 代码库 > HDU_1022
HDU_1022
/*
#include <iostream>
#include <stack>
#include <string>
using namespace std;
string a,b;
int res[100100];
int main()
{
int n;
while(cin >> n >> a >> b)
{
stack<char> s;
int j = 0, i = 0, k = 0;
s.push(a[0]);
res[k++] = 1;
while(i < n && j < n)
{
if(s.size() != 0 && s.top() == b[j])
{
j++;
s.pop();
res[k++] = 0;
}
else{
s.push(a[++i]);
res[k++] = 1;
}
}
if(i == n)
{
cout << "No." << endl;
}
else {
cout << "Yes." << endl;
for(int i = 0; i < k; i++)
{
if(res[i])
{
cout << "in" << endl;
}
else {
cout << "out" << endl;
}
}
}
cout<<"FINISH"<<endl;
}
return 0;
}
HDU_1022