View Code of Problem 58

#include<stdio.h>
#include<string.h>
int main()
{
    char str[1000];
    gets(str);
    int len=strlen(str),i,flag=0,count=0;
    for(i=0;i<len;i++)
    {
        if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
        {
            if(flag==0)
            {
                count++;
                flag=1;
            }

        }
        else
            flag=0;
    }
    printf("%d",count);
    return 0;
}

Double click to view unformatted code.


Back to problem 58