#K8671. Card Hand Scoring

    ID: 36925 Type: Default 1000ms 256MiB

Card Hand Scoring

Card Hand Scoring

You are given a hand of playing cards for one or more players. Each card in the hand has a point value associated with it. The point values are defined as follows:

  • Cards with numbers 2 through 10 have points equal to their face value, i.e., \(score = card\_value\) for \(card\_value \in \{2, 3, \ldots, 10\}\).
  • The face cards Jack (J), Queen (Q), and King (K) each have a score of 10.
  • The Ace (A) has a score of 11.

You need to calculate the total score for the hand of each player.

Example:

For a hand containing: 10 J Q 9 A, the total score is \(10 + 10 + 10 + 9 + 11 = 50\).

inputFormat

The input is read from standard input and has the following format:

  1. The first line contains a single integer \(N\) representing the number of players.
  2. The following \(N\) lines each contain a space-separated list of cards representing a player's hand.

Each card is given as one of the following strings: 2 - 10, J, Q, K, or A.

outputFormat

For each player's hand, output the total score on a separate line to standard output.

The score is computed by summing the values of the cards in the hand according to the rules provided.

## sample
3
10 J Q 9 A
9 8 3 2 K
A A A 5 5
50

32 43

</p>