Reverse a string without using a loop in C.
Anonym
The simplest way to reverse a string or any other container without an explicit loop in C++ is to use reverse iterators: string input; cin >> input; // the pair of iterators rbegin/rend represent a reversed string string output ( input.rbegin ( ), input.rend ( ) ) ; cout << output << endl;