시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB31252382.143%

문제

Wibowo and his girlfriend are playing with a deck of card. A deck consists of 52 different cards. Each card has a number (from lowest to highest: 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace) and a suit (from weakest to strongest: Diamond, Club, Heart, Spade). When two cards are compared, the one with higher number is considered win. If they have the same number then the stronger suit will win.

First, Wibowo and his girlfriend split the deck so each one get 26 cards. The game consists of 26 rounds. In each round, both Wibowo and his girlfriend pick one card from their hand at the same time and compare it. The winner get one point for that round.

Given the initial hand, Wibowo wondered what is the highest point he could possibly get by playing that hand with his girlfriend.

입력

The first line of input contains an integer T (T ≤ 100) denoting the number of case. Each case is described in a line which contains 26 cards, the Wibowo‟s hand. Each card has two characters, the first one is number and the second one is suit. A number can be varied between 2, 3, 4, 5, 6, 7, 8, 9, T (10), J (Jack), Q (Queen), K (King), A (Ace). A suit can be varied between D (Diamond), C (Club), H (Heart), S (Spade). Each card is separated by a single space and all cards are distinct.

출력

For each case, output in a line a single integer the highest point that Wibowo possibly get by playing that hand.

예제 입력 1

3
2D 2C 2H 2S 3D 3C 3H 3S 4D 4C 4H 4S 5D 5C 5H 5S 6D 6C 6H 6S 7D 7C 7H 7S 8D 8C
8H 8S 9D 9C 9H 9S TD TC TH TS JD JC JH JS QD QC QH QS KD KC KH KS AD AC AH AS
2D TC 2C 9S 6H TH TD 8H 6S 3C 5H 3S TS 4C 5S JD 3D 2H 6C 7S 9C 6D 8D 4H 9H 5C

예제 출력 1

0
26
11