시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 64 MB27922020178.824%

문제

Anisa (Player A) and Ben (Player B) are playing a singles badminton match. Here are the basic badminton rules:

  • To win a match, a player needs to win 2 out of 3 games.
  • The first player to reach 21 points wins the game. (A different rule applies when the players are tied 20-20. You may assume this case does not happen.)
  • Either player can score a point no matter who serves.
  • After a game is won, a new game begins and the score resets to 0-0.

입력

A sequence of A’s and B’s that records which player scored for each serve.

출력

The score and who wins the match (A or B).

예제 입력 1

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

예제 출력 1

21-0
21-0
A

예제 입력 2

BBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBB

예제 출력 2

0-21
21-0
0-21
B

예제 입력 3

ABBBBAABABBAABABAABBBAABBBAABBBAAAAAAAABBBAABAAABBBBBBAABBBBBAABBBBAAABBAAABBBBAAAABBAABBBABBAABBABBBABAABAABAAA

예제 출력 3

21-18
12-21
21-19
A