View Code of Problem 58

#include<stdio.h>
main()
{
	char str[100];
	int i,word=0,num=0;
	gets(str);
    for(i=0;str[i]!='\0';i++)
	{
		if(str[i]>='A'&&str[i]<='z')
		{
			if(word==0)
			{
				num++;
			}
			word=1;
		}
		else if(str[i]==' ')
		{
			word=0;
		}
	}
	printf("%d",num);
}

Double click to view unformatted code.


Back to problem 58