View Code of Problem 58

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[105];
	gets(a);
	int flag=1,s=0;
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]!=' ')
		{
			if(flag==1)	
	         s++;
	     	flag=0;
	}
	else
	flag=1;
}
    printf("%d\n",s);
return 0;
	
}
 

Double click to view unformatted code.


Back to problem 58