Character reverse order (note that use puts() to read spaces)

character reverse order

Time Limit: 1s Memory Limit: 64MB Committed: 38979 Solved: 21375

topic description

Reverse the contents of a string str and output it. The length of str does not exceed 100 characters.

input format

Input consists of one line. The string entered on the first line.

output format

Output the converted string in reverse order.

sample input

I am a student

sample output

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;
}

Guess you like

Origin blog.csdn.net/m0_56501550/article/details/130019556