使用string头文件中含有的reverse函数即可实现数组反转
#include <bits/stdc++.h> using namespace std; int main() { string s; cin>>s; reverse(s.begin(),s.end()); cout<<s; }