#include <iostream> #include <string> using namespace std; int main() { string str; int temp; getline(cin, str); for (int i = 0; i < str.length() / 2; i++) { temp = str[i]; str[i] = str[str.length() - i - 1]; str[str.length() - i - 1] = temp; } cout << str << endl; return 0; } |
Double click to view unformatted code.