At a carnival booth, a player draws exactly 5 tickets from a bin. Every ticket shows two things: a machine number from 1 to 13 (the game station it is redeemable at) and a color, one of exactly four colors. The booth awards a prize tier based on the 5 drawn tickets, ranked from best to worst:
Given the 5 machine numbers and the 5 colors, output the name of the best (highest-ranked) tier the draw qualifies for.
Line 1: 5 space-separated integers, the machine numbers, in ticket order. Line 2: 5 space-separated single uppercase letters (each one of 'A', 'B', 'C', 'D'), the colors, in the same ticket order.
One line containing exactly one of: "Color Jackpot", "Triple Match", "Pair Match", "Consolation Prize".
Example 1
Input
1 1 1 5 9 A B C D A
Expected
Triple Match
Explanation
The colors A,B,C,D,A are not all identical, so Color Jackpot does not apply. Machine number 1 appears 3 times (the highest frequency), so the draw qualifies for Triple Match.
Example 2
Input
3 3 5 5 9 A B C D A
Expected
Pair Match
Explanation
The colors are not all identical. The machine numbers have two ties: 3 appears twice and 5 appears twice, so the maximum frequency is 2 (never reaching 3), giving Pair Match.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →