View Code of Problem 58

#include<stdio.h>
#include<string.h>
int main()
{
	char ch[1000];
	int i,n,cnt=0;
	gets(ch);
	n = strlen(ch);
	for(i=0;i<n;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