题解 | #字符串反转#
字符串反转
https://www.nowcoder.com/practice/e45e078701ab4e4cb49393ae30f1bb04?tpId=37&tags=&title=&difficulty=0&judgeStatus=0&rp=1&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D2%26tpId%3D37%26type%3D37
/* 思路: 调用algorithm库里面的reverse函数可以直接对字符串反转,然后输出。 */ #include <algorithm> #include <iostream> using namespace std; int main() { string str; getline(cin, str); reverse(str.begin(), str.end()); cout << str << endl; return 0; } // 64 位输出请用 printf("%lld")