Chili Peppers
Time limit1sMemory limit1024 MB
Sums the SHU values of the peppers named in the input, using a fixed lookup table of six pepper types.
- Level
Easy1 of 10
- Topics
- Implementation, Hash map
- Solved
- No attempts yet
Problem
Ron is cooking chili using an assortment of peppers.
The spiciness of a pepper is measured in Scoville Heat Units (SHU). Ron's chili is currently not spicy at all, but each time Ron adds a pepper, the total spiciness of the chili increases by the SHU value of that pepper.
The SHU values of the peppers available to Ron are shown in the following table:
Your job is to determine the total spiciness of Ron's chili after he has finished adding peppers.
Input
The first line of input contains a positive integer , the number of peppers Ron adds to his chili. The next lines each contain the name of a pepper Ron has added. Each pepper name exactly matches a name in the table above. The same pepper can be added more than once.
Output
Print a positive integer , the total spiciness of Ron's chili.