fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string str, s, res = "";
  8. while (getline(cin, str))
  9. {
  10. str += " ";
  11. for (int i = 0; i < str.size(); i++)
  12. {
  13. s += str[i];
  14. if (!(isalpha(str[i])))
  15. {
  16. s.pop_back();
  17. reverse(s.begin(), s.end());
  18. res += s;
  19. res += str[i];
  20. s = "";
  21. }
  22. }
  23. cout << "'" << res << "'\n";
  24. res = "";
  25. }
  26. // system("pause");
  27. // return 0;
  28. }
Success #stdin #stdout 0s 4216KB
stdin
test
it now
stdout
'tset '
'ti won '