string s;
list< char > res;
int main( ) {
boost;
tcase {
cin >> s;
int n = sz( s) ;
res.clear ( ) ;
list< char > :: iterator it = res.begin ( ) ;
rep( i, 0 , n - 1 ) {
if ( s[ i] == '<' ) {
if ( it ! = res.begin ( ) ) {
it-- ;
}
} else if ( s[ i] == '>' ) {
if ( it ! = res.end ( ) ) {
it++ ;
}
} else if ( s[ i] == '-' ) {
if ( it ! = res.begin ( ) ) {
it-- ;
it = res.erase ( it) ;
}
} else {
res.insert ( it, s[ i] ) ;
}
}
fore( x, res) {
cout << x;
}
cout << endl;
}
return 0 ;
}
c3RyaW5nIHM7Cmxpc3Q8Y2hhcj4gcmVzOwppbnQgbWFpbigpIHsKICBib29zdDsKICB0Y2FzZSB7CiAgICBjaW4gPj4gczsKICAgIGludCBuID0gc3oocyk7CiAgICByZXMuY2xlYXIoKTsKICAgIGxpc3Q8Y2hhcj46Oml0ZXJhdG9yIGl0ID0gcmVzLmJlZ2luKCk7CiAgICByZXAoaSwgMCwgbiAtIDEpIHsKICAgICAgaWYoc1tpXSA9PSAnPCcpIHsKICAgICAgICBpZihpdCAhPSByZXMuYmVnaW4oKSkgewogICAgICAgICAgaXQtLTsKICAgICAgICB9CiAgICAgIH0gZWxzZSBpZihzW2ldID09ICc+JykgewogICAgICAgIGlmKGl0ICE9IHJlcy5lbmQoKSkgewogICAgICAgICAgaXQrKzsKICAgICAgICB9CiAgICAgIH0gZWxzZSBpZihzW2ldID09ICctJykgewogICAgICAgIGlmKGl0ICE9IHJlcy5iZWdpbigpKSB7CiAgICAgICAgICBpdC0tOwogICAgICAgICAgaXQgPSByZXMuZXJhc2UoaXQpOwogICAgICAgIH0KICAgICAgfSBlbHNlIHsKICAgICAgICByZXMuaW5zZXJ0KGl0LCBzW2ldKTsKICAgICAgfQogICAgfQogICAgZm9yZSh4LCByZXMpIHsKICAgICAgY291dCA8PCB4OwogICAgfQogICAgY291dCA8PCBlbmRsOwogIH0KICByZXR1cm4gMDsKfQ==
compilation info
prog.cpp:1:1: error: 'string' does not name a type
string s;
^
prog.cpp:2:1: error: 'list' does not name a type
list<char> res;
^
prog.cpp: In function 'int main()':
prog.cpp:4:3: error: 'boost' was not declared in this scope
boost;
^
prog.cpp:5:3: error: 'tcase' was not declared in this scope
tcase {
^
stdout