View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114