Black Jack is a card game where the aim is to obtain a hand of cards with a value of no more than 21. The game is played in casinos where players bet money on the result, but this is a friendly version with no money at stake. Instead we are counting the number of wins for each player.
There are 52 cards in a standard pack, 4 of each of 13 values. In Black Jack, cards have the following values:
In this version of Black Jack, these rules must be followed:
A number of scenarios are presented, each beginning with 52 card values in a random order. The last line contains just # - this line is not to be processed. The second line of a scenario contains the names of from 1 to 5 players, separated by spaces.
For each scenario, present a single line with the names of the players (in the same order as the input) each followed by their number of wins. Follow this with “dealer” and the dealer's number of wins. Names and wins are separated by single spaces.
3A9A285TA36T648K52J45J29677984QT5Q77K964TQJKJK32Q83A John Sally Peter 4Q52Q372A4T78A7TT53T9A8J6962A587KQK95Q6J96J3K8424J3K Jenny Siobhan #
John 2 Sally 2 Peter 1 dealer 6 Jenny 2 Siobhan 2 dealer 6