c++字符串逆序输出

1008.字符串操作

时间限制:1000MS  内存限制:65535KB

题目描述:

输入一个字符串,把其中的字符按逆序输出。如LIGHT,输出THGIL,要求用string类

输入:

一个字符串

输出:

字符串的逆序

示例:

input

LIGHT

output

THGIL
#include
#include
using namespace std;
int main()
{
	string string1;
	cin >> string1;
	string s(string1.rbegin(), string1.rend());
	cout << s << endl;
	return 0;
}

你可能感兴趣的:(c++字符串逆序输出)