13064 - Young People won't Say Wood   

Description

According to Master Ma, young people will not say "wood".   The more times a person says "wood", the more likely that person is old.  Master Ma wants to warn the young people.  He downloads posts from forums, analyzes their comments, and determines the user's age using the following formula:

 

In the forum, every sentence ends with a period. Master Ma uses the number of periods to count the sentences.

He soon finds that besides "wood", sometimes young people uses "vv" instead of "w", "0" instead of "o", "cl" (English alphabets, not numbers) instead of "d" when spelling "wood". For example, "vvood", "w0od", "vv00cl" are alias of "wood". More formally, any word that starts with "w" or "vv", followed by a combination of "0" and "o" with length 2, and ended with "cl" or "d" are considered to be equal to "wood".

Some young people also embeds "wood" (or words equal to "wood") in longer words. Master Ma identifies them as well. For example, the word "woody" and "xxxwoodxxxw00dxx" is identified because "wood" (or words equal to "wood") is embedded in it.

(Figure: The blue highlighted parts are the "wood" identified by Master Ma. The other parts are examples that are not equal to "wood".)

Given a post downloaded by Master Ma. Please help Master Ma to calculate the age of the users since he needs some time to recover.

Maybe useful hints

You may need to use fgets, strtokstrstr,  or whatever string related function. The reference to the functions are provided in this link.

Some explanation on Sample IO

User with id 0 wrote three sentences: "Ha.", "Ha.", and "Ha.". Zero of the sentences include "wood". Therefore output 0 3 in the 0-th line.

User with id 2 wrote two sentences among all his comments. Two of the sentences include "wood". Therefore output 2 2 in the 2-nd line.

User with id 9 wrote two sentences. Only one sentence include "wood". Therefore output 1 2 in the 9-th line.

Input

The are several lines in a post, ended with EOF (end of file).

Each line is in the following format: "<user id>":"<comment of user>", where

  • <user id> is an non-negative integer less than 10, i.e. 0-9

  • <comment of user> consists of lower-case alphabets a-z, numbers 0-9, whitespace , comma ,, and period .; the comment may contain more than one sentence and is guaranteed to end with a period.

Technical Restriction

  • There are at most 25 lines.

  • Length of each line in the input file is at most 1000.

Output

Please output 10 lines, in the i-th line, please output the followings separated with space:

  • number of sentences including "wood" (or strings equal to "wood") in all comments of the user with id i

  • number of sentences in all comments of the user with id i

If a user has no comment in the post, please output 0 0.

Sample Input  Download

Sample Output  Download

Tags




Discuss