Card game
You will be building a program to play a card game. The objective of the game is to form a hand of three cards that for each of three different properties are either all the same or all different.
The properties of a card are:
- Prefix: “+”, “-”, or “=”
- Letter: “A”, “B”, or “C”
- Number of letters: 1, 2, or 3 (e.g. A, AA, AAA)
For example, given the following set of cards
-A -B -BB +C -C -CC =CCC
there are two possible hands:
+C -CC =CCC
- prefix: +,-,= are all different
- letter: C, C, C are all the same
- number of letters: 1, 2, 3 are all different
-A -B -C
- Prefix: -, -, - are all the same
- Letter: A, B, C are all different
- Number of letters: 1, 1, 1 are all the same
Specifications:
- You only need to find one hand
- The cards should be read from STDIN, each card is separated by a space
- Print the hand you find to STDOUT, space separated (trailing space is ok)
- Cards may appear in any order in the input
- Cards may be output in any order