#include <iostream>
#include <string>
void print_reverse( const std::string& s ) {
if( !s.empty() ) {
// print the reverse of all characters in the string other than the first character
// pseudocode: print_rev( s[1..s.length] )
// C++ code: print the reverse of the substring starting at position 1
print_reverse( s.substr(1) ) ;
// after that print the first character
// pseudocode: print( s[0] )
std::cout << s.front() ; // C++ code: print the first character
}
}
int main()
{
const std::string str = "hcstueD reteP - enivid esrucer ot ,namuh si etareti oT" ;
std::cout << str << "\n\n" ;
print_reverse(str) ;
std::cout << '\n' ;
}