View Code of Problem 58

#include<stdio.h>
#include<string.h>
int main()
{
char str[100];
gets(str);
int len=strlen(str);
int i,w=0;
int count=0;
for(i=0;str[i]!='\0';i++){
	if(str[i]== ' '){
		w=0;
	}else if(w==0){
		w=1;
		count++;
	}
}	
	printf("%d",count);
	return 0;
 } 

Double click to view unformatted code.


Back to problem 58