fork download
  1. #include<bits/stdc++.h>;
  2. using namespace std;
  3. int main()
  4. {
  5. int t;
  6. cin>>t;
  7. getchar();
  8. int i;
  9. string s;
  10. while(t--)
  11. {
  12. getline(cin,s);
  13.  
  14. string temp;
  15. vector <string> cds;
  16. stringstream ss (s);
  17. while(ss >> temp)//please explain what is being done in this line
  18. cds.push_back(temp);
  19. reverse(cds.begin(),cds.end());
  20. for(i=0;i<cds.size();i++)
  21. {
  22. cout<<cds[i]<<" ";
  23. }
  24. cout<<endl;
  25. //* */
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 3284KB
stdin
1
hello world
stdout
world hello