eolymp
bolt
Try our new interface for solving problems
Problems

King`s Poker

King`s Poker

Poker is one of the most widely played card games, and King's Poker is one of its variations. The game is played with a normal deck of \textbf{52} cards. Each card has one of \textbf{4} suits and one of \textbf{13} ranks. However, in King's Poker card suits are not relevant, while ranks are \textit{Ace} (rank \textbf{1}), \textbf{2}, \textbf{3}, \textbf{4}, \textbf{5}, \textbf{6}, \textbf{7}, \textbf{8}, \textbf{9}, \textbf{10}, \textit{Jack} (rank \textbf{11}), \textit{Queen} (rank \textbf{12}) and \textit{King} (rank \textbf{13}). The name of the game comes from the fact that in King's Poker, the King is the highest ranked card. But this is not the only di erence between regular Poker and King's Poker. Players of King's Poker are dealt a hand of just three cards. There are three types of hands: \begin{itemize} \item A set, made of three cards of the same rank. \item A pair, which contains two cards of the same rank, with the other card unmatched. \item A no-pair, where no two cards have the same rank. \end{itemize} Hands are ranked using the following rules: \begin{itemize} \item Any set defeats any pair and any no-pair. \item Any pair defeats any no-pair. \item A set formed with higher ranked cards defeats any set formed with lower ranked cards. \item If the matched cards of two pairs have di erent ranks, then the pair with the higher ranked matched cards defeats the pair with the lower ranked matched cards. \item If the matched cards of two pairs have the same rank, then the unmatched card of both hands are compared; the pair with the higher ranked unmatched card defeats the pair with the lower ranked unmatched card, unless both unmatched cards have the same rank, in which case there is a tie. \end{itemize} A new software house wants to o er King's Poker games in its on-line playing site, and needs a piece of software that, given a hand of King's Poker, determines the set or pair with the lowest rank that beats the given hand. Can you code it? \InputFile Each test case is described using a single line. The line contains three integers \textbf{A}, \textbf{B}, and \textbf{C} representing the ranks of the cards dealt in a hand (\textbf{1} ≤ \textbf{A}, \textbf{B}, \textbf{C} ≤ \textbf{13}). The last test case is followed by a line containing three zeros. \OutputFile For each test case output a single line. If there exists a set or a pair that beats the given hand, write the lowest ranked such a hand. The beating hand must be written by specifying the ranks of their cards, in non-decreasing order. If no set or pair beats the given hand, write the character '\textbf{*}' (asterisk).
Time limit 1 second
Memory limit 64 MiB
Input example #1
1 1 1
1 1 12
1 1 13
1 13 1
10 13 10
1 2 2
13 13 13
13 12 13
12 12 12
3 1 4
1 5 9
0 0 0
Output example #1
2 2 2
1 1 13
1 2 2
1 2 2
1 11 11
2 2 3
*
1 1 1
13 13 13
1 1 2
1 1 2
Source ACM ICPC Latin America 2011, November 4th-5th, 2011