-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeijuOJ.cpp
48 lines (42 loc) · 895 Bytes
/
beijuOJ.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <fstream>
#include <iostream>
#include <list>
#include <string>
#include <vector>
using namespace std;
int main()
{
while (!(cin.eof()))
{
string temp = "";
getline(cin, temp);
if (temp == "")
{
break;
}
list<char> out;
auto it = out.end();
int size = temp.size();
for (int i = 0; i <= size - 1; ++i)
{
if (temp[i] == '[')
{
it = out.begin();
}
else if (temp[i] == ']')
{
it = out.end();
}
else
{
out.insert(it, temp[i]);
}
}
for (auto i = out.begin(); i != out.end(); ++i)
{
cout << *i;
}
cout << '\n';
}
return 0;
}