fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int i=0;
  9. string a;
  10. getline(cin,a);
  11. while(a[i])
  12. {
  13. ++i;
  14. }
  15. --i;
  16. while(i>=0)
  17. {
  18. cout<<a[i];
  19. --i;
  20. }
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 15240KB
stdin
1 2 3
stdout
3 2 1