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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.