1096: 字符逆序
Time Limit: 1 Sec??Memory Limit: 64 MB
Submit: 2017??Solved: 1059
[Submit][Status][Web Board]
Description
將一個字符串str的內容顛倒過來,并輸出。str的長度不超過100個字符。
Input
輸入包括一行。 第一行輸入的字符串。
Output
輸出轉換好的逆序字符串。
Sample Input
I am a student
Sample Output
tneduts a ma I
HINT
?
Source
freeproblemset
AC代碼
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{char str[1000];gets(str);int length=strlen(str);for(int i=length-1;i>=0;i--)cout<<str[i];cout<<endl;return 0;
}
?