Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
My solution for UVA 11988
#include <iostream>
#include <list>
using namespace std;
#define maxn 100005
string s;
list<char> chars;
int main() {
while(cin >> s) {
list<char>::iterator it = chars.begin();
for(char c : s) {
if(c == '[') it = chars.begin();
else if(c == ']') it = chars.end();
else chars.insert(it, c);
for(list<char>::iterator jt = chars.begin(); jt!=chars.end(); ++jt) {
cout << *jt;
cout << '\n';
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.