字符逆序(注意使用puts()读空格)

字符逆序

时间限制: 1s 内存限制: 64MB 提交: 38979 解决: 21375

题目描述

将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。

输入格式

输入包括一行。 第一行输入的字符串。

输出格式

输出转换好的逆序字符串。

样例输入

I am a student

样例输出

tneduts a ma I
#include<bits/stdc++.h>
using namespace std;
char a[105];
int main() {
	gets(a);
	for(int i=strlen(a)-1;i>=0;i--){
		printf("%c",a[i]);
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/m0_56501550/article/details/130019556