Rock, Paper, Scissors

Time limit1sMemory limit128 MB

Problem

Rock, Paper, Scissors is a classic two-player hand game. In each round, both players simultaneously form one of three shapes: Rock (a fist), Paper (an open hand), or Scissors (a two-finger V). The winner of a round is decided by the table below.

RockbeatsScissors
PaperbeatsRock
ScissorsbeatsPaper

If both players show the same shape, the round is a tie (no winner).

Given the sequence of shapes each player throws across a series of rounds, count how many rounds each player wins.

For example, consider these five rounds:

Round    : 1 2 3 4 5
Player 1 : R R S R S
Player 2 : S R S P S

Player 1 wins round 1 (Rock beats Scissors), Player 2 wins round 4 (Paper beats Rock), and all other rounds are ties.

Note: R stands for Rock, P for Paper, and S for Scissors.

Input

The input consists of 1 to 20 pairs of lines. In each pair, the first line holds Player 1's shapes and the second line holds Player 2's shapes. Within a pair, both lines contain the same number of characters, each taken from the set {R, P, S}, and that count is between 1 and 75 inclusive. A pair of lines that each contain the single character E marks the end of the input and is not processed.

Output

For each input pair, print two lines: P1: x and P2: y, where x is the number of rounds won by Player 1 and y is the number won by Player 2.