View Code of Problem 58

#include<stdio.h>
int main()
{
	char str[100];
	int i,count=0;
	//scanf("%s",str); 
	gets(str);
	for(i=0;str[i]!='\0';i++)
	{
		if(str[i]!=' ')
		{
			
			if(str[i+1]==' '||str[i+1]=='\0')
			      count++;
			
		}
		
		  
	}
	printf("%d",count);
	
}

Double click to view unformatted code.


Back to problem 58