Table Tennis Match
Time limit1sMemory limit1024 MB
Given the predicted winner of each of N rounds, simulate the table tennis match and print the final score, which stops early once one player leads by 2 points.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Problem
Dalgu and Phoenix like playing table tennis. Yun-i watches them play again today and decides to predict who will win the match.
The match follows these rules. At the start, both Dalgu and Phoenix have points. The match consists of rounds, and the winner of each round gets point. The match ends when all rounds are finished or when one player leads by points during the match. No further rounds are played after that.
Yun-i predicts the winner of each of the rounds in advance. If Yun-i's predictions come true, find the final score of the match.
Input
The first line contains the number of rounds ().
Each of the next lines contains a single character, the predicted winner of that round. D means Dalgu is predicted to win, and P means Phoenix is predicted to win.
Output
After the match ends, let the scores of Dalgu and Phoenix be and . Print them in the format X:Y.