View Code of Problem 58

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

Double click to view unformatted code.


Back to problem 58