Algorithm
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string line;
|
||||
while (getline(cin, line)) { // һ<>ζ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>У<EFBFBD>ֱ<EFBFBD><D6B1> EOF
|
||||
list<char> s;
|
||||
auto it = s.begin();
|
||||
|
||||
for (char tmp : line) {
|
||||
if (tmp == '[') {
|
||||
it = s.begin();
|
||||
}
|
||||
else if (tmp == ']') {
|
||||
it = s.end();
|
||||
}
|
||||
else {
|
||||
it = s.insert(it, tmp);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
for (char c : s) cout << c;
|
||||
cout << '\n'; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user