View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114