Poker Hand
Time limit1sMemory limit1024 MB
Given five cards per hand, the task is to find the largest number of cards that share the same rank.
- Level
Easy1 of 10
- Topics
- Hash map, Implementation
- Solved
- No attempts yet
Problem
You are given a five-card hand drawn from a standard 52-card deck. Each card has a rank (one of A, 2, 3, ..., 9, T, J, Q, K) and a suit (one of C, D, H, S). The strength of your hand is the maximum value such that cards in your hand share the same rank.
Find the strength of your hand.
Input
The first line contains a single integer , the number of datasets. Each dataset is one line with five two-character strings separated by spaces. The first character of each string is the rank, one of A23456789TJQK. The second character is the suit, one of CDHS. All five strings are distinct.
Output
For each dataset, print the strength of the hand on a single line.