Poker face

Here, you are asked to write a program that receives a sequence of poker
hands, and evaluates whether or not each is a straight, flush, or a
straight flush. A hand here consists of 5 cards; each card is specified
by a value (an int between 1 and 13, inclusive) and a suit (an int
between 0 and 3, inclusive; 0 represents clubs, 1 represents diamonds, 2
represents hearts, and 3 represents spades). A hand is defined to be a
straight if the values are—up to reordering—5 consecutive values, where
the ace value (1) may be the highest or the lowest; it is defined to be
a flush if all of the suits are the same; and, it is defined to be a
straight flush if it is both a straight and a flush.

Input

A number n ≥ 1, followed by n hands.

Output

For each hand, output two lines:

On the first line, print out the cards in the hand in a comma-separated
sequence, using the word Ace to represent the value 1, Jack to represent
the value 11, Queen to represent the value 12, and King to represent the
value 13. Follow the examples.

On the second line, output “Straight flush” if the hand is a straight
flush, “Straight” if the hand is a straight but not a flush, “Flush” if
the hand is a flush but not a straight, and “None” otherwise.

Observation

Problem information

Author: Hubie Chen

Generation: 2026-01-25T22:02:47.381Z

© Jutge.org, 2006–2026.
https://jutge.org
