View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114