View Code of Problem 114

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

Double click to view unformatted code.


Back to problem 114