/*
问题 1093: 字符逆序
时间限制: 1Sec 内存限制: 64MB 提交: 1413 解决: 733
题目描述
将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。
输入
输入包括一行。 第一行输入的字符串。
输出
输出转换好的逆序字符串。
样例输入
I am a student
样例输出
tneduts a ma I
*/
/*
Author:YuBo
Date:2018/2/1
*/
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
string s;
getline(cin,s);//读入string
reverse(s.begin(),s.end());
cout<<s<<endl;
}
注意读入一行,包括空格。
string的使用:http://blog.csdn.net/lady_killer9/article/details/79283440
有问题请下方评论,转载请注明出处,并附有原文链接,谢谢!如有侵权,请及时联系。