Created
February 21, 2015 19:13
-
-
Save ChanChar/bc9f8306350d748d25f5 to your computer and use it in GitHub Desktop.
Rock Paper Scissors Solution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number_of_cases = int(input()) | |
for case in range(number_of_cases): | |
games = [outcome for outcome in input().split()] | |
player1_score = 0 | |
player2_score = 0 | |
player1_wins = ["PR", "RS", "SP"] | |
player2_wins = ["RP", "SR", "PS"] | |
for game in games: | |
if game in player1_wins: | |
player1_score += 1 | |
elif game in player2_wins: | |
player2_score += 1 | |
if player1_score > player2_score: | |
print(1, end=' ') | |
else: | |
print(2, end=' ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment