Sunday, February 27, 2011

494 - Kindergarten Counting Game


#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
    char sen[100];
    long int c=0,w=0,i;
    //freopen("in.txt","r",stdin);
    while(gets(sen))
    {
        c=0;w=0;
        for(i=0;sen[i];i++)
        {
            if((sen[i]>='A'&&sen[i]<='Z')||(sen[i]>='a'&&sen[i]<='z'))
                w=1;
            else
            {
                if(w)c++;
                w=0;
            }
               
        }
        cout<<c<<endl;
        c=0;w=0;
    }
    exit(0);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.