ECOO 2015 R1 P4 - Neanderthal Numbers
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 colleagues 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 \(10\) test cases. Each test case consists of a single line of text with \(N\) \((1 \le N \le 50)\) 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 \(2\) test cases, but the real data files will contain \(10\).
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
Comments