시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 68 48 44 70.968%

문제

Rock, Paper, Scissors is a classic hand game for two people. Each participant holds out either a fist (rock), open hand (paper), or two-finger V (scissors). If both players show the same gesture, they try again. They continue until there are two different gestures. The winner is then determined according to the table below:

Rock beats Scissors
Paper beats Rock
Scissors beats Paper

Your task is to take a list of symbols representing the gestures of two players and determine how many games each player wins.

In the following example:

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

Player 1 wins at Turn 1 (Rock beats Scissors), Player 2 wins at Turn 4 (Paper beats Rock), and all the other turns are ties.

입력

The input contains between 1 and 20 pairs of lines, the first for Player 1 and the second for Player 2. Both player lines contain the same number of symbols from the set {'R', 'P', 'S'}.  The number of symbols per line is between 1 and 75, inclusive.  A pair of lines each containing the single character 'E' signifies the end of the input.

출력

For each pair of input lines, output a pair of output lines as shown in the sample output, indicating the number of games won by each player.

예제 입력 1

RRSRS
SRSPS
PPP
SSS
SPPSRR
PSPSRS
E
E

예제 출력 1

P1: 1
P2: 1
P1: 0
P2: 3
P1: 2
P2: 1
W3sicHJvYmxlbV9pZCI6IjQ1OTMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJSb2NrLCBQYXBlciwgU2Npc3NvcnMiLCJkZXNjcmlwdGlvbiI6IjxwPlJvY2ssIFBhcGVyLCBTY2lzc29ycyBpcyBhIGNsYXNzaWMgaGFuZCBnYW1lIGZvciB0d28gcGVvcGxlLiBFYWNoIHBhcnRpY2lwYW50IGhvbGRzIG91dCBlaXRoZXIgYSBmaXN0IChyb2NrKSwgb3BlbiBoYW5kIChwYXBlciksIG9yIHR3by1maW5nZXIgViAoc2Npc3NvcnMpLiBJZiBib3RoIHBsYXllcnMgc2hvdyB0aGUgc2FtZSBnZXN0dXJlLCB0aGV5IHRyeSBhZ2Fpbi4gVGhleSBjb250aW51ZSB1bnRpbCB0aGVyZSBhcmUgdHdvIGRpZmZlcmVudCBnZXN0dXJl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