fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. main() {
  4. int t;
  5. string s;
  6. cin >> t;
  7. cin.ignore();
  8. while(t--) {
  9. getline(cin,s);
  10. string tmp;
  11. stringstream v(s);
  12. stack<string> st;
  13. while(v>>tmp) st.push(tmp);
  14. while(st.size()) {
  15. cout << st.top() <<" ";
  16. st.pop();
  17. }
  18. cout << endl;
  19. }
  20. }
Success #stdin #stdout 0.01s 5520KB
stdin
2
I like this program very much
much very program this like I
stdout
much very program this like I 
I like this program very much