View Code of Problem 58

# include <stdio.h>
# include <string.h>

int main(void)
{
	int len , i , count = 0 , flag = 1 ;
	char str[1000];
	gets(str);
	len = strlen(str);
	for(i = 0 ; i < len ; i++)
	{
		if ( (str[i]>='a'&&str[i]<='z' || str[i]>='A'&&str[i]<='Z' ) )
		{
			if(flag == 1)
			{
				count++;
				flag = 0;
			}
		}
		else 
			flag = 1;
	}
	printf("%d\n",count);
	
	return 0;
}

Double click to view unformatted code.


Back to problem 58