Poker Hand
InterviewTime limit2sMemory limit512 MB
Given five distinct cards, report the largest number of cards sharing one rank.
- Level
Easy2 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. The strength of your hand is the maximum value k such that there are k cards in your hand that have the same rank.
Compute the strength of your hand.
Input
The input consists of a single line, with five two-character strings separated by spaces.
The first character in each string is the rank of the card, and is one of A23456789TJQK. The second character in the string is the suit of the card, and is one of CDHS.
You may assume all the strings are distinct.
Output
Output, on a single line, the strength of your hand.