View Code of Problem 58

# include<stdio.h>
# include<string.h>
int main(void)
{
  int i,j,count = 0;
  char a[1000];
  gets(a);
  j = strlen(a);
  for(i=0;i<j;++i)
  {
    if(a[i]>='a'&&a[i]<='z'&&a[i+1]==' ')
    {
      ++count;
    }
  }
  if(a[j-1]!=' ')
  {
	  ++count;
  }
  printf("%d\n",count);
  return 0;
}

Double click to view unformatted code.


Back to problem 58