시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 64 MB 8 5 4 57.143%

문제

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).

예제 입력

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

예제 출력

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

힌트