Orko is a two-player card game. Each card has a colour (Red, Yellow, Green, or Black) and a value (1, 2, 3, 4, or 5). The deck contains twenty cards, one for each distinct combination of colour and value.
Each player is dealt ten of the twenty cards. The game is played over ten rounds, and the objective is to win as many rounds as possible. In each round the player who holds the lead plays one of his cards. The other player must play a card of the same colour if he has one; otherwise he may play any of his cards.
The player with the lead wins the round in either of these cases:
Otherwise the other player wins the round.
The lead for the first round is chosen arbitrarily; the lead for each subsequent round goes to the winner of the previous round.
Assuming that each player follows the strategy that maximizes the number of rounds he wins, determine how many rounds each player wins.
The input contains several test cases. Each test case consists of one line describing the cards dealt to one of the players, Player $A$. Each card is given by a letter (R, Y, G, B) denoting its colour, followed by a digit denoting its value (1, 2, 3, 4, 5). The other player, Player $B$, receives the remaining cards of the deck.
A line containing ten stars separated by spaces
* * * * * * * * * *
follows the last test case.
For each test case, output on a single line an integer between $0$ and $10$: the number of rounds won by Player $A$. Assume that Player $A$ has the lead for the first round.