CSE 2031 - Lab Test 1 question

What to do

Requirements

Your program will read several bridge hands from the user (see details below). It will then output only these hands that have the maximum number of high card points (HCP). This must be the only output from your program, i.e. you do not need to prompt the user for the various inputs nor do you need to print out the maximum HCP value.

The first line of input will contain only one integer (guaranteed to fit into an int). This is the number of bridge hands that will follow.

The remaining input will be a series of bridge hands (as many as the first input indicated) in the same format as the assignment, i.e. 4 lines per hand, the first character in each line is the suit, the remaining are the cards in descending order.

See the sample run below for an example of the input.

Your program must read all the hands, and then output only the hands that correspond to the maximum HCP. Do not output the HCP value, only the hands exactly as inputted.

The HCP value of a hand is only the first part of the point calculation for the assignment, i.e. 4 points for an ace (A), 3 points for a king (K), 2 points for a queen (Q), 1 point for a jack (J). No points are given for long suits.

You can assume that the input that will be provided to your program will be valid, i.e. the suits and cards are in the right order, there are no invalid cards or suits, and there are exactly 13 cards per hand.

Following is a sample run. Input provided is shown in red, while output created by your program in black.



4
SAKT2
HAKT2
DAKT2
CA
SAKT2
HAKT2
DAKT2
CK
SAQT2
HAKT2
DAKT2
CA
SAKT2
HAKJ2
DAQT2
CA
SAKT2
HAKT2
DAKT2
CA
SAKT2
HAKJ2
DAQT2
CA