Tuesday 17 May 2011

494-Kinter girden counting game

#include<stdio.h>
int main()
{
    char line[100];
    int wordcounter=0,i=0,flag=0;
    freopen("in.txt","r",stdin);
    while(gets(line)!=NULL)
    {
        while(line[i])
        {
            if((line[i]>='A' && line[i]<='Z')||(line[i]>='a' && line[i]<='z'))
                flag=1;
            else
            {
                if(flag)
                    wordcounter++;
                flag=0;
            }
            i++;
        }
        printf("%d\n",wordcounter);
        wordcounter=i=flag=0;
    }
    return(0);
}

1 comment:

  1. Hello my friend! I have been visiting your blog. Cool! Congratulations for your work. I invite you to visit my blog at:
    http://nelsonsouzza.blogspot.com
    I hope you all have a great evening!

    ReplyDelete