View Code of Problem 114

# include<stdio.h>
# include<string.h>
int Alpha(char c){
	return (c>='A'&&c<='Z')||(c>='a'&&c<='z');
}
int main(){
	char str[10000];
	while(gets(str)){
		int len=strlen(str);
		for(int i=0;i<len;i++){
			if(Alpha(str[i])){
					int n,j;
				for(j=i;j<len;j++){
					if(Alpha(str[j])){
						n=j;
					}
					else{
						break;
					}
				}
				for(j=j-1;j>=i;j--){
					printf("%c",str[j]);
				}
				i=n;
			}
			else{
				printf("%c",str[i]);
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114