View Code of Problem 114

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

char str[10000];


int main(){
	
	while(gets(str)){
		int len = strlen(str);
		int start=-1,end=-1;
		for(int i=0; i<len; i++){
			if((str[i]>='a'&& str[i]<='z')||(str[i]>='A'&& str[i]<='z')){
				int start = i;
				while((str[i]>='a'&& str[i]<='z')||(str[i]>='A'&& str[i]<='z'))
					i++;
				int end = i-1;
				for(;end>=start;end--)
					printf("%c",str[end]);
				i = i -1;
			
			}else
				printf("%c",str[i]);
		}
		printf("\n");
	
	
	}


	return 0;
}

Double click to view unformatted code.


Back to problem 114