fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. void printReverse(string str){
  5. int len=str.length();
  6. for(int i=0;i<len;i++){
  7. cout<<str[len-(i+1)];
  8. }
  9. cout<<endl;
  10. }
  11. int main(){
  12. string str;
  13. std::getline(std::cin,str);
  14. printReverse(str);
  15. return 0;
  16. }
Success #stdin #stdout 0s 3032KB
stdin
hello there!
stdout
!ereht olleh