View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114