问题 C: 数组逆置
时间限制: 1 Sec 内存限制: 32 MB
献花: 100 解决: 83
[献花][花圈][TK题库]
题目描述
输入一个字符串,长度小于等于200,然后将数组逆置输出。
输入
测试数据有多组,每组输入一个字符串。
输出
对于每组输入,请输出逆置后的结果。
样例输入
tianqin
样例输出
niqnait
提示
注意输入的字符串可能会有空格。
#define _CRT_SECURE_NO_WARNINGS
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
using namespace std;
int main()
{
#ifdef _DEBUG
freopen("data.txt", "r+", stdin);
#endif // _DEBUG
string str;
while (getline(cin,str))
{
reverse(str.begin(), str.end());
printf("%s\n", str.c_str());
}
return 0;
}
/**************************************************************
Problem: 1967
User: Sharwen
Language: C++
Result: 升仙
Time:3 ms
Memory:1708 kb
****************************************************************/