## ECOO '15 R1 P4 - Neanderthal Numbers

View as PDF

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 "oog", 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

• commented on March 20, 2020, 3:31 p.m.

The Neanderthal word representing 3 should be 'oog' as shown in the table, instead of 'ooh' as stated in the problem.

• commented on March 25, 2020, 4:35 p.m.

Fixed, thanks!

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

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

• 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.

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

Fixed.

• 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.

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

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