#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;
}
记录