Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。
Input
输入包括一行。
第一行输入的字符串。
Output
输出转换好的逆序字符串。
Sample Input
I am a student
Sample Output
tneduts a ma I
Hint
Source
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char a[101];
int n,i;
gets(a);
n = strlen(a);
for(i=n-1;i>=0;i--)
{
printf("%c",a[i]);
}
printf("\n");
return 0;
}
运行结果:
I am a sutdent
tnedtus a ma I
Process returned 0 (0x0) execution time : 13.039 s
Press any key to continue.