## ECOO '15 R1 P4 - Neanderthal Numbers

View as PDF

Points: 10 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

Lefty the Neanderthal is in the process of discovering counting for the first time in history. Using the fingers of his right hand, Lefty assigns each of them a name. he names the first finger "ook", the second finger "ook ook", the third "ooh", the fourth "ooga" and the fifth "ug". For many says this is enough, allowing Lefty to quickly express a count to his collegues in words that are more precise than "many" and "lots".

One day lefty was stuck... after he counted ug shiny beads he realized he had more! So he took a look at his right foot and started naming his toes! He called his toes "mook", "mook mook", "oogam", "oogum" and "ug ug". Now lefty can count all kinds of things!

Number Neanderthal Number Word
0 No such concept
1 ook
2 ook ook
3 oog
4 ooga
5 ug
6 mook
7 mook mook
8 oogam
9 oogum
10 ug ug

The input will contain test cases. Each test case consists of a single line of text with Neanderthal number words. The words are not separated by spaces. You must parse each line and print out (on a single line) the number of possible sequences of Neanderthal numbers that can be represented by a Neanderthal person speaking the words aloud (for example the string "oogamookoogumook" could be "ooga mook oogum ook" meaning "4 6 9 1" or "oogam ook oogum ook" meaning "8 1 9 1".

Note that the sample input below only contains test cases, but the real data files will contain .

#### Sample Input

ookookook
oogamookoogumook

#### Sample Output

3
2

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org

• KevinWan  commented on March 22, 2018, 10:44 a.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• yantran  commented on Nov. 9, 2015, 8:17 a.m.

To clear up future confusion, the problem statement states that 5 = "uh" but the table states that 5 = "ug". It should be "ug" through the whole problem.

• cheesecake  commented on Nov. 9, 2015, 5:05 p.m.

Fixed.

• ZaManlyMan  commented on May 11, 2015, 1:16 p.m. edited

This comment is hidden due to too much negative feedback. Click here to view it.

• nullptr  commented on April 3, 2015, 11:22 a.m.

A single test case may actually contain up to 100 Neanderthal number words.