View Code of Problem 114

# include<stdio.h>
# include<string.h>
void print(char str[],int j){
	for(j=j-1;j>=0;j--){
		printf("%c",str[j]);
	}
}
int main(){
	char str[1000],str_1[50];
	int j=0;
	gets(str);
	int len=strlen(str);
    for(int i=0;i<len;i++){
    	if(str[i]!=' '){
    		str_1[j++]=str[i];
    		if(i==len-1){
    			print(str_1,j);
			}
		}
		else{
			print(str_1,j);
			printf(" ");
			j=0;
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114