#include <iostream>
#include <algorithm>
using namespace std;
void rev_str ()
{
char str[81];
cout << "Please enter a string: ";
cin.getline(str, 81);
int len = cin.gcount();
for (int i = 0; i < len--; i++) {
// http://e...content-available-to-author-only...e.com/w/cpp/algorithm/swap
swap(str[i], str[len]);
}
cout << str << endl;
}
int main() {
rev_str();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCByZXZfc3RyICgpCnsKCWNoYXIgc3RyWzgxXTsKCWNvdXQgPDwgIlBsZWFzZSBlbnRlciBhIHN0cmluZzogIjsKCWNpbi5nZXRsaW5lKHN0ciwgODEpOwoJaW50IGxlbiA9IGNpbi5nY291bnQoKTsKCQoJZm9yIChpbnQgaSA9IDA7IGkgPCBsZW4tLTsgaSsrKSB7CiAgICAJLy8gaHR0cDovL2UuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmUuY29tL3cvY3BwL2FsZ29yaXRobS9zd2FwCiAgICAJc3dhcChzdHJbaV0sIHN0cltsZW5dKTsKCX0KCQoJY291dCA8PCBzdHIgPDwgZW5kbDsKfQoKaW50IG1haW4oKSB7CgkKCXJldl9zdHIoKTsKCXJldHVybiAwOwp9