Advertisement
Saleh127

uri1451

Apr 1st, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. string a;
  6. int i,j,k,l;
  7. list<char>b;
  8. list<char>::iterator fn;
  9. while(cin >> a)
  10. {
  11. fn = b.begin();
  12. for( i=0; i<a.size(); i++)
  13. {
  14. if(a[i] == ']')
  15. {
  16. fn = b.end();
  17. }
  18. else if(a[i] == '[')
  19. {
  20. fn = b.begin();
  21. }
  22. else
  23. {
  24. b.insert(fn, a[i]);
  25. }
  26. }
  27. for(fn = b.begin(); fn != b.end(); fn++)
  28. {
  29. cout << *fn;
  30. }
  31. cout <<endl;
  32. b.clear();
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement