ZOJ_1295

#include <cstdlib> #include <iostream> #include <algorithm> using namespace std; const int MAX = 80; int main(int argc, char *argv[]) { //freopen("input.txt", "rt", stdin); //freopen("output.txt", "wt", stdout); char ch[MAX]; int flag = 0; while(cin.getline(ch, 80)) { if(flag == 0) { flag = 1; continue; } int size = strlen(ch) - 1; int hafSize = (size + 1) / 2; for(int i=0; i<hafSize; i++) swap(ch[i], ch[size - i]); cout << ch << endl; } return EXIT_SUCCESS; }  

你可能感兴趣的:(ZOJ_1295)