之前上机都用C,后来发现C++有很多函数很方便,果断转C++

这个题就用到了reverse翻转函数,只需要指明需要翻转的范围即可。

#include <algorithm>
#include <iostream>
using namespace std;
#include<string>

int main() {
    string str;
    while (cin >> str) { // 注意 while 处理多个 case

        reverse(&str[0],&str[4]);
        cout <<str<< endl;
    }
}
// 64 位输出请用 printf("%lld")