题目描述:
输入一个字符串,长度小于等于200,然后将数组逆置输出。
输入:
测试数据有多组,每组输入一个字符串。
输出:
对于每组输入,请输出逆置后的结果。
样例输入:
hdssg
样例输出:
gssdh
来源:
2011年哈尔滨工业大学计算机研究生机试真题
没想到九度上还有这么简单的题,害得我以为有什么陷阱,原来没有套路。
/*
* 1055.c
*
* Created on: 2017年3月26日
* Author: Aurora
*/
#include<stdio.h>
#include<string.h>
int main(){
char ch[200];
int l;
while(scanf("%s", ch)!= EOF){
l= strlen(ch);
for(int i= l-1; i>= 0; i--){
printf("%c", ch[i]);
}
printf("\n");
memset(ch, 0, sizeof(ch));
}
return 0;
}