Guest User

Untitled

a guest
Dec 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. string reverse (string temp , int length )
  2. {
  3. if(length==1)
  4. { return temp; }
  5. else
  6. {
  7.  
  8.  
  9. int t = (temp.length ()+1) / 2;
  10. return (reverse( temp.substr(t, temp.length() -1 ), t) + reverse ( temp.substr(0 ,t ) ,t ) );
  11.  
  12.  
  13.  
  14. }
  15.  
  16. }
  17.  
  18. int main( ) {
  19. string s;
  20. cin>>s;
  21. string rev = reverse (s , s.length() );
  22. cout <<"n"<<rev;
  23. cin>>s;
  24.  
  25. return 0;
  26. }
Add Comment
Please, Sign In to add comment