提交时间:2019-12-24 23:04:16

运行 ID: 3867

#include <iostream> #include <string> using namespace std; int main() { int C, len, i = 0; string str1,str2; char temp; cin>>C; while(i<C) { cin>>str1; len = str1.length(); temp = str1[0]; str1[0] = str1[1]; str1[1] = temp; for(int j = 1; j<=(len/2-1); ++j) { temp = str1[j*2]; str1[j*2] = str1[j*2+1]; str1[j*2+1] = temp; } cout<<str1<<endl; ++i; } return 0; }