Poker Solitaire Evaluator: Input
Poker Solitaire Evaluator: Input
Input
The input will contain several test cases. First line of the input is the an integer which indicate the
number of test case followed by a blank line. Each consecutive test case will also separated by a blank
line.
Each test case gets 25 cards, 5 cards per line. Each card consists of two characters. The first
represents the rank of the card: ‘A’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘X’, ‘J’, ‘Q’, ‘K’. The second represents
the suit of the card: ‘S’, ‘H’, ‘D’, ‘C’.
The cards are dealt into a 5 × 5 square. Each row and column is evaluated to determine the highest
hand type for which its 5 cards qualify. The hand types, from low to high, are Nothing, Pair, Two Pair,
Three of a Kind, Straight, Flush, Full House, Four of a Kind, Straight Flush. A hand qualifies only
once, and then only for its highest type. For example, a Four of a Kind does not count as two pair or
three of a kind.
Output
For each test case output a list of 9 integers, telling how many hands of each handtype were found.
from lowest to highest, being:
1. Nothing: does not qualify as any of the following. Example: AC, 3H, QS, JD, 7D.
2. One Pair: contains two cards of the same rank and does not qualify for any of the following.
Example: 2C, 3H, 4H, 2H, KD.
3. Two Pair: contains two cards of one rank and two cards of another and does not qualify for any
of the following. Example: 2C, 3H, 4H, 2H, 4D.
4. Three of a Kind: contains three cards of the same rank and does not qualify for any of the
following. Example: QS, KH, 2C, QD, QC.
5. Straight: the five cards of the hand may be sorted on rank so that an unbroken sequence of
5 ranks is formed and the hand does not qualify for any of the following. There can be cycle
through Ace. That is AC, 2H, 4D, 3H, 5S forms a straight, as does JH, XD, QC, KD, AS and QC, KD,
AS, 2H, 3D.
6. Flush: the five cards are all of the same suit and the hand does not qualify for any of the following.
Example: 5D, AD, KD, 7D, QD.
7. Full House: the hand contains three cards of one rank and two cards of another. Example: 3C,
QS, QD, 3H, 3S.
8. Four of a kind: the hand contains four cards of the same rank. Example: AS, AD, AH, 7C, AC.
9. Straight Flush: the hand meets the criteria for being both a straight and a flush.
Sample Input
1
AS 2S 3S 4S 5S
AC 2H 3H 5C 4C
AH 2D KC KH 5D
AD 3D KD 9D 8D
XH 3C XC XS 8C
Sample Output
1, 1, 2, 1, 1, 1, 1, 1, 1