View Code of Problem 114

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
	char a[1000];
	int i,j;
	while(gets(a)!=NULL){
		for(i=0;i<strlen(a);i++){
			int r=0;
			if((a[i]>='a' && a[i]<='z')|| (a[i]>='A' && a[i]<='Z')){
				for(j=i;j<strlen(a);j++){
					if(a[j]>='a' && a[j]<='z' || a[j]>='A' && a[j]<='Z'){
						r++;
					}
					else{
						break;
					}
				}
				for(j=r+i-1;j>=i;j--){
					printf("%c",a[j]);
				}
				i=i+r-1;
			}
			else{
				printf("%c",a[i]);
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114