View Code of Problem 58

#include <stdio.h>
#include <string.h>
int main()
{
	char ch[1000];
	gets(ch);
	int len,i,count=0;
	len = strlen(ch);
	for(i=0;i<len;++i)
	{
		if( (ch[i]>='a'&&ch[i]<='z') || (ch[i]>='A'&&ch[i]<='Z'))
		{
			if(ch[i+1] == 32)
			  {
			  	count++;
			  }
		}
	}
	printf("%d",count);
	return 0;
}

Double click to view unformatted code.


Back to problem 58