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(){
	int i,j,len,cnt,k;
	char str[1000];
	while(gets(str)){
		len=strlen(str);
		for(i=0;i<len;i++)
			if(isp(str[i])){
				cnt=1;
				for(j=i+1;j<len;j++)
					if(isp(str[j])==0) 
						break;
					else cnt++;
				for(j=i+cnt-1;j>=i;j--)
					printf("%c",str[j]);
				i=i+cnt-1;
			}
			else printf("%c",str[i]);
		printf("\n");
	}
	return 0;
	 
}

Double click to view unformatted code.


Back to problem 114