View Code of Problem 58

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
   char a[100];
   gets(a);
   int flag=0,i;
   int length;

   for(i=0;i<strlen(a);i++)
   {
       if(((a[i]>='A'&&a[i]<='Z')||(a[i]>='a'&&a[i]<='z'))&&flag==0)
       {
           flag=1;
           length++;
       }
       else if(a[i]==' ')
       {
           flag=0;
       }

   }
   printf("%d",length);

    return 0;
}

Double click to view unformatted code.


Back to problem 58