F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Count The Keyword

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 249    Accepted Submission(s): 45


Problem Description
John loves various languages. Recently he begins to learn C programming language. He is interested in the keyword of C and knows the importance of keywords. So each time he gets a C program source code, he counts the the appearance of the valid keyword first. However, when the code is long, John can't count it correctly. Now he needs your help, he will give you some C code, and he wants you tell him the correct number of the appearance of the keyword.
In order to make the problem easier. John provides you some information.
1, the code don't contain "#define", i.e. the code don't contain the Macro definition .
2, the code may contain type cast, i.e. int a = (int)b;
3, the keywords in the comments are not valid.
4, the keywords in a string are not valid, and the character in the string will be expressed by letter. i.e. The string like "ab\x40" will not appear.
5, it guarantees that a word or a statement is in the same line, but one line may contain many words or statements.
6, one line contain no more than 300 characters and one word is less than 50 characters.
 

Input
The input file contains no more than 10 cases.
Each case contains a completely or incompletely correct C program and cases are separated by a line contains only four '#', i.e. "####".
 

Output
Each case outputs a number which is the sum of the Keyword appears.
 

Sample Input
#include main(){ int a; int b; scanf("%d%d",&a,&b); printf("%d\n",a+b); }
 

Sample Output
2
 

Hint
Below is the 32 keywords in C language.
auto break case char const continue default
do double else enum extern float for
goto if int long register return short
signed static sizeof struct switch typedef union
unsigned void volatile while
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 17:07:01, Gzip enabled