#include <iostream>
#include <stdlib.h>
#include <algorithm>
using namespace std;
void func()
{
string s;
while(cin>>s)
{
reverse(s.begin(),s.end());
cout<<s<<endl;
}
}
int main(int argc, char *argv[])
{
//printf("Hello, world\n");
func();
return 0;
}
再次偷懒,直接reverse了,真正思路是两边向中间循环,swap
-
题目描述:
-
输入一个字符串,长度小于等于200,然后将数组逆置输出。
-
输入:
-
测试数据有多组,每组输入一个字符串。
-
输出:
-
对于每组输入,请输出逆置后的结果。
-
样例输入:
-
hdssg
-
样例输出:
-
gssdh