View Code of Problem 114

#include <stdio.h>
#include <string.h>
int isp(char a){
	return (a<='z'&&a>='a') ||(a<='Z'&&a>='A'); 
}
int main(){
	char str[100];
	while(gets(str)){
		int len = strlen(str);
		int n,i,j,k;
		for(i=0;i<len;i++)
			if(isp(str[i])){
				n=1;
				for(j=i+1;j<len;j++)
					if(isp(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