fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <algorithm>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main() {
  8. string s;
  9. bool first;
  10. while(getline(cin, s)){
  11. istringstream is(s);
  12. first = true;
  13. while(is>>s){
  14. reverse(s.begin(), s.end());
  15. if(!first) cout<<" ";
  16. cout<<s;
  17. first = false;
  18. }
  19. cout<<endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 2824KB
stdin
I love you.
You love me.
We're a happy family.
stdout
I evol .uoy
uoY evol .em
er'eW a yppah .ylimaf