描述
将一个字符串str的内容颠倒过来,并输出。
数据范围:1≤len(str)≤10000 1≤len(str)≤10000
输入描述:
输入一个字符串,可以有空格
输出描述:
输出逆序的字符串
示例1
输入:
I am a student
复制输出:
tneduts a ma I
复制
示例2
输入:
nowcoder
复制输出:
redocwon
复制
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;int main() {string str;while(getline(cin,str)){for(int i=str.size()-1;i>=0;i--){cout<<str[i];}cout<<endl;}return 0;}
// 64 位输出请用 printf("%lld")