[NYOJ] [1265] Reverse String Output

Problem Description

Loading...

Problem Analysis

Output in reverse order

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<stdio.h>
#include<string.h>
int main() {
	int T;
	scanf("%d",&T);
	getchar();
	while(T--) {
		char s[50];
		gets(s);
		int l=strlen(s)-1;
		for(int i=l; i>=0; i--)
			if(s[i]<='z'&&s[i]>='a')
				printf("%c",s[i]);
		printf("\n");
	}
	return 0;
}

Problem link: [NYOJ] [1265] String Reverse Order Output

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...