#P7797. Belote Card Game Scoring
Belote Card Game Scoring
Belote Card Game Scoring
There is a card game called Belote which uses 8 different cards: A, K, Q, J, T, 9, 8, and 7. Each card has two different point values depending on whether it is a trump card or not. The point values are defined as follows in LaTeX format:
$$\begin{array}{|c|c|c|} \hline \text{Card} & \text{Trump Value} & \text{Non-Trump Value} \\ \hline A & 11 & 11 \\ K & 4 & 4 \\ Q & 3 & 3 \\ J & 20 & 2 \\ T & 10 & 10 \\ 9 & 14 & 0 \\ 8 & 0 & 0 \\ 7 & 0 & 0 \\ \hline \end{array} $$Mirko has 4×N cards. The first input line contains an integer N and a single uppercase letter representing the trump suit. The second line contains 4×N cards separated by spaces. Each card is represented by a two-character string. The first character denotes the rank (one of A, K, Q, J, T, 9, 8, 7) and the second character denotes the card's suit. A card is considered to be a trump card if its suit matches the provided trump suit. Your task is to calculate the total sum of all card values according to the table above.
inputFormat
The input consists of two lines:
- The first line contains an integer
N
(1 ≤ N ≤ 100,000) and a single uppercase letter representing the trump suit, separated by a space. - The second line contains 4×N cards separated by spaces. Each card is represented by a two-character string: the first character is the rank (A, K, Q, J, T, 9, 8, 7) and the second is the suit.
outputFormat
Output a single integer, the total score of Mirko's cards.
sample
1 H
AH 9H 7S KD
29