#include<bits/stdc++.h>
using namespace std;
int main()
{
list<char>a;
list<char> :: iterator r = a.begin();
string s;
int i;
while(cin >> s)
{
a.clear();
for(i=0;i<s.size();i++)
{
if(s[i] == '[')
r = a.begin();
else if(s[i] == ']')
r = a.end();
else
a.insert(r, s[i]);
}
for(r=a.begin();r!=a.end();r++)
cout << *r;
cout << endl;
}
return 0;
}
using namespace std;
int main()
{
list<char>a;
list<char> :: iterator r = a.begin();
string s;
int i;
while(cin >> s)
{
a.clear();
for(i=0;i<s.size();i++)
{
if(s[i] == '[')
r = a.begin();
else if(s[i] == ']')
r = a.end();
else
a.insert(r, s[i]);
}
for(r=a.begin();r!=a.end();r++)
cout << *r;
cout << endl;
}
return 0;
}
Comments
Post a Comment