Kindergarten Counting Game

原创 2013年12月05日 19:18:56

Everybody sit down in a circle. Ok. Listen to me carefully.

``Woooooo, you scwewy wabbit!''

Now, could someone tell me how many words I just said?

Input and Output

Input to your program will consist of a series of lines, each line containing multiple words (at least one). A ``word'' is defined as a consecutive sequence of letters (upper and/or lower case).

Your program should output a word count for each line of input. Each word count should be printed on a separate line.

Sample Input

Meep Meep!
I tot I taw a putty tat.
I did! I did! I did taw a putty tat.
Shsssssssssh ... I am hunting wabbits. Heh Heh Heh Heh ...

Sample Output

2
7
10
9
#include <stdio.h>
#include <string.h>

int main()
{
   char st[10000] = {'\0'};
   char *p = st;
   int i = 0,l,j,bo = 0,sum = 0;

   while(gets(st)!=NULL)
   {
       sum = 0;bo = 0;i = 0;
   l = strlen(st);
    if((st[0]>='A' && st[0]<='Z')||(st[0]>='a' && st[0]<='z'))
        bo = 1;
    else
        bo = 0;
   for(j = 1;j<l;j++)
   {
       if((st[j]>='A' && st[j]<='Z')||(st[j]>='a' && st[j]<='z'))
        bo = 1;
        else
        {
            if(bo == 1)
                {
                sum++;
                bo = 0;
                }
        }
    }
   printf("%d\n",sum);
   }
    return 0;
}


相关文章推荐

UVA 494 Kindergarten Counting Game 单词统计

原题: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem...

UVa494 - Kindergarten Counting Game,java写的

我用java写的,在我的电脑中能运行

ACdream1008:A Very Easy Triangle Counting Game

Problem Description Speedcell and Shoutmon love triangles very much.One day,they are playing a ga...

群赛11.10 A Very Easy Triangle Counting Game

Problem G: A Very Easy Triangle Counting Game Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 80  ...

KinderGarten(备用资料)

  • 2010年01月21日 12:31
  • 1.59MB
  • 下载

poj 3692 Kindergarten(最大独立点集 + 二分图最大匹配)

http://poj.org/problem?id=3692 题意:在幼儿园中,有许多小孩。其中有男孩,也有女孩。女孩之间相互认识,男孩之间也相互认识。同时,一些男孩和女孩之间也相互认识,有一天,老师...

HDU 2458Kindergarten(二分图 最大团点数)

Kindergarten Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T...

POJ 3692Kindergarten(二分图最大匹配之最小顶点匹配)

题目地址:

POJ 3692 Kindergarten(最大独立集)

POJ 3692 Kindergarten(最大独立集) http://poj.org/problem?id=3692 题意:        已知班级有g个女孩和b个男孩,所有女生之间都相互认识,所有...

Poj 3692 Kindergarten【最大团】

Kindergarten Time Limit: 2000MS   Memory Limit: 65536K Total Submissions...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Kindergarten Counting Game
举报原因:
原因补充:

(最多只允许输入30个字)