#include<cstdio>
#include<cstring>
#include <cstdlib>
#include<algorithm>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <iostream>
#include <stack>
#include <list>
using namespace std;
int main(){
list<char> text;
list<char>::iterator it = text.begin();
char ch;
while((ch = getchar()) != EOF){
if(ch =='['){
it = text.begin();
}else if(ch == ']'){
it = text.end();
}else{
it = text.insert(it,ch);
it++;
}
}
for(it = text.begin(); it != text.end(); it++){
printf("%c",*it);
}
printf("\n");
}
求问求问,一直WA┭┮﹏┭┮