Tyrion, son of Tywin was released from the dungeons of vale after his champion Bronn defeated Ser Vardis in the trial by combat.
As a Lannister always pays his debts, he invited Bronn to play a game of mastermind with him.
The game is played as follows:
Tyrion has rocks of 7 colours. (As he is rich, he has infinitely many of each colour) He makes a sequence of length 10 from these rocks. The colours are: VIBGYOR (Each letter is associated to corresponding colour)
Now Bronn chooses the number of times he wants to play. (No. of test cases) Then each time he has to guess a sequence of 10 rocks. Based on each guess Tyrion rewards Bronn 1 gold coin for a rock which is correct in colour and position both and 1 silver coin for a rock which is correct in colour only.
Input: The first line contains the secret sequence of Tyrion The next line contains an integer t, no. of times bronn choses to play. The next t lines each contain a sequence.
Output: For each t lines you have to print the number of golds followed by number of silvers.
Eg:
Input:
ROYGBIVVOG
3
VIBGYORROY
RRRRRVVVVV
ROYGBIVVGO
Output:
2 6
3 0
8 2
Input:
IBVIGBVVRV
5
GGVRIOYGRO
YROGVBIOBG
ORYVYBYOOI
BBIRRVVIVV
VRRVOGGGGO
Output:
2 2
1 5
1 3
3 6
0 4