eolymp
bolt
Try our new interface for solving problems
Problems

Romantic Date

Romantic Date

Wibowo and his girlfriend are playing with a deck of card. A deck consists of \textbf{52} different cards. Each card has a number (from lowest to highest: \textbf{2}, \textbf{3}, \textbf{4}, \textbf{5}, \textbf{6}, \textbf{7}, \textbf{8}, \textbf{9}, \textbf{10}, \textbf{Jack}, \textbf{Queen}, \textbf{King}, \textbf{Ace}) and a suit (from weakest to strongest: \textbf{Diamond}, \textbf{Club}, \textbf{Heart}, \textbf{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 \textbf{26} cards. The game consists of \textbf{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. \InputFile The first line of input contains an integer \textbf{T} (\textbf{T} ≤ \textbf{100}) denoting the number of test cases. Each case is described in a line which contains \textbf{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 \textbf{2}, \textbf{3}, \textbf{4}, \textbf{5}, \textbf{6}, \textbf{7}, \textbf{8}, \textbf{9}, \textbf{T} (\textbf{10}), \textbf{J} (Jack), \textbf{Q} (Queen), \textbf{K} (King), \textbf{A} (Ace). A suit can be varied between \textbf{D} (Diamond), \textbf{C} (Club), \textbf{H} (Heart), \textbf{S} (Spade). Each card is separated by a single space and all cards are distinct. \OutputFile For each case, output in a line a single integer the highest point that Wibowo possibly get by playing that hand.
Time limit 0.5 seconds
Memory limit 64 MiB
Input example #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
Output example #1
0
26
11
Source ACM-ICPC 2010 Jakarta