80分RE求调
查看原帖
80分RE求调
1373570
AlanBeaker楼主2024/10/11 17:41
#include <bits/stdc++.h>
using namespace std;
int n;
string x;
stack <string> s;
stack <string> out;
int main()
{
    cin >> n;
    for(int i=1;i<=n;i++)
    {
        cin >> x;
        if(x=="<bs>")
            s.pop();
        else
            s.push(x);
    }
    while(!s.empty())
    {
    	out.push(s.top());
    	s.pop();
	}
	while(!out.empty())
    {
        cout << out.top() << " ";
        out.pop();
	}
    return 0;
}

记录

2024/10/11 17:41
加载中...