When I eat my Smarties I always eat the red ones last. I separate them into their color groups and I start by eating the orange ones, then blue, green, yellow, pink, violet, brown and finally red. The red ones are the best, so I eat them slowly one at a time. The other colors I eat quickly by the handful (my hand can hold a maximum of
But wait, there's more! I have turned my Smartie-eating into a science. I know it always takes me exactly
The input will contain end of box
meaning there are no more Smarties in the box for that test case.
Your program should output a single line for each test case indicating how long (in seconds) it will take me to eat the entire box according to the rules given above. Note that the sample input below only contains
Sample Input
red
brown
brown
violet
blue
pink
blue
blue
pink
brown
yellow
brown
pink
violet
green
yellow
red
orange
orange
blue
brown
pink
red
red
red
brown
orange
orange
green
red
orange
violet
blue
pink
yellow
pink
brown
orange
green
red
blue
yellow
green
orange
brown
orange
pink
violet
brown
red
end of box
Sample Output
245
Note: Only
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
Caution, pay extra attention to the 'The input will contain 10 test cases.'
This test goes against the typical convention i've see on here, and expects you to process all 10 test cases in the same execution. If you are only getting the first test case right, and all others wrong, you likely made the same mistake/assumption that I did and only processed the first test case.