int-programming
int-programming
PROBLEM: Agram is a card game for 2 players, using the cards from a standard 52-card pack.
The dealer deals five cards to each player. The opponent player leads any card, playing it face up
in the middle of the playing area. The following strategy will be used to determine which card
the dealer will play:
• He plays the lowest card in that suit that is of a higher value than the
card the opponent played.
• If he does not have such a card, he plays his lowest card in that suit.
• If he does not have a card in that suit, he plays the lowest value card
regardless of suit. We guarantee there will be no ties.
INPUT: There will be 5 lines of input. Each line will contain the opponent’s lead card and the
5 cards held by the dealer. All cards will be represented by 2-character strings in value-suit
order. AH represents the ace of hearts. K, Q and J and T will be used for king, queen, jack and
10 respectively. Note that the ace in this game has the lowest rank.
OUTPUT: For each input line, print the card the dealer must play according to the strategy
listed above.
TEST DATA