UVA Solution 494 Kindergarten Counting Game


Solution in C:

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

            }


        }
        printf("%d\n",words);
        words=0;

    }

}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.