问题 F: 数组逆置

题目描述

输入一个字符串,长度小于等于200,然后将数组逆置输出。

输入

测试数据有多组,每组输入一个字符串。

输出

对于每组输入,请输出逆置后的结果。

样例输入

tianqin

样例输出

niqnait

提示

注意输入的字符串可能会有空格。


#include<cstdio>
#include<cstring>
int main(){
	char a[201];
	while(gets(a)){
		int len=0;
		len=strlen(a);
		for(int i=len-1; i>=0; i--){
			printf("%c", a[i]);
		}
		printf("\n");
	}
	return 0;
}


猜你喜欢

转载自blog.csdn.net/chuyuan_li/article/details/81007485