7 kyu

Simple Fun #320: Scratch lottery I

445 of 1,347myjinxin2015

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

Puzzles
Regular Expressions

Stats:

CreatedJun 21, 2017
PublishedJun 21, 2017
Warriors Trained1846
Total Skips21
Total Code Submissions3646
Total Times Completed1347
JavaScript Completions603
Ruby Completions84
C# Completions134
PHP Completions123
Python Completions445
Crystal Completions6
Haskell Completions36
Total Stars21
% of votes with a positive feedback rating94% of 305
Total "Very Satisfied" Votes271
Total "Somewhat Satisfied" Votes29
Total "Not Satisfied" Votes5
Total Rank Assessments6
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • donaldsebleung Avatar
  • kazk Avatar
  • Souzooka Avatar
  • leesc22 Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • Just4FunCoder Avatar
  • farhanaditya Avatar
  • saudiGuy Avatar
Ad