fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. std::string str;
  8. std::getline(std::cin, str);
  9. std::string str_reversed;
  10. std::reverse_copy(std::begin(str), std::end(str), std::back_inserter(str_reversed));
  11. std::cout << str_reversed << std::endl;
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 3476KB
stdin
123456789
stdout
987654321