Simple Fun #320: Scratch lottery I
Description:
Task
You got a scratch lottery
, you want to know how much money you win.
There are 6
sets of characters on the lottery. Each set of characters represents a chance to win. The text has a coating on it. When you buy the lottery ticket and then blow it off, you can see the text information below the coating.
Each set of characters contains three animal names and a number, like this: "tiger tiger tiger 100"
. If the three animal names are the same, Congratulations, you won the prize. You will win the same bonus as the last number.
Given the lottery
, returns the total amount of the bonus.
Input/Output
[input]
string array lottery
A string array that contains six sets of characters.
[output]
an integer
the total amount of the bonus.
Example
For
lottery = [
"tiger tiger tiger 100",
"rabbit dragon snake 100",
"rat ox pig 1000",
"dog cock sheep 10",
"horse monkey rat 5",
"dog dog dog 1000"
]
the output should be 1100
.
"tiger tiger tiger 100"
win $100, and "dog dog dog 1000"
win $1000.
100 + 1000 = 1100
Similar Kata:
Stats:
Created | Jun 21, 2017 |
Published | Jun 21, 2017 |
Warriors Trained | 1846 |
Total Skips | 21 |
Total Code Submissions | 3646 |
Total Times Completed | 1347 |
JavaScript Completions | 603 |
Ruby Completions | 84 |
C# Completions | 134 |
PHP Completions | 123 |
Python Completions | 445 |
Crystal Completions | 6 |
Haskell Completions | 36 |
Total Stars | 21 |
% of votes with a positive feedback rating | 94% of 305 |
Total "Very Satisfied" Votes | 271 |
Total "Somewhat Satisfied" Votes | 29 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |