View Code of Problem 58

#include<string.h>
#include<math.h>
#include<stdio.h>
#include<ctype.h>
int main()
{
	char a[1000];
	gets(a);
	int i,k=0;
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]==' '&&a[i+1]!=' ') 
		{
			k++;
		}
	 } 
	 if(a[0]!=' ')
	 printf("%d",k++);
	 else 
	 printf("%d",k);
	return 0;
 } 

Double click to view unformatted code.


Back to problem 58