View Code of Problem 58

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

Double click to view unformatted code.


Back to problem 58