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 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.