Card Game

No attempts yetTime limit1sMemory limit128 MB

Problem

Write a program that keeps score for a simple two-player game played with a deck of cards. The deck has $52$ cards: four of each of the $13$ possible names two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace. The cards jack, queen, king, and ace are collectively known as high cards.

The deck is shuffled and placed face-down on the table. Player A turns over the top card and puts it on a pile; then player B turns over the top card and puts it on the pile. A and B keep alternating until the deck is exhausted. Score the game as follows:

  • If a player turns over an ace while at least $4$ cards remain to be turned over and none of the next $4$ cards is a high card, that player scores $4$ points.
  • If a player turns over a king while at least $3$ cards remain to be turned over and none of the next $3$ cards is a high card, that player scores $3$ points.
  • If a player turns over a queen while at least $2$ cards remain to be turned over and none of the next $2$ cards is a high card, that player scores $2$ points.
  • If a player turns over a jack while at least $1$ card remains to be turned over and the next card is not a high card, that player scores $1$ point.

Input

The input contains $52$ lines. Each line contains the name of one card in the deck, in lowercase letters. The first line is the first card to be turned over, the next line is the next card, and so on.

Output

Whenever a player scores, print Player X scores n point(s)., where X is the player's name (A or B) and $n$ is the number of points scored (1, 2, 3, or 4). At the end of the game, print each player's total score on two lines:

Player A: n point(s).
Player B: m point(s).