#P1042. [NOIP 2003 普及组] 乒乓球

[NOIP 2003 普及组] 乒乓球

Description

Huahua analyzes the match in the following way: first, list the outcome of each rally, then compute the match results under the 1111-point system and the 2121-point system (up to the end of the record).

For example, consider the following record (where W\texttt W means Huahua scores a point, and L\texttt L means Huahua’s opponent scores a point):

WWWWWWWWWWWWWWWWWWWWWWLW\texttt{WWWWWWWWWWWWWWWWWWWWWWLW}

Under the 1111-point system, Huahua wins game 11 by 1111 to 00, wins game 22 by 1111 to 00, and game 33 is in progress with the current score 11 to 11. Under the 2121-point system, Huahua wins game 11 by 2121 to 00, and game 22 is in progress with the score 22 to 11. If a game has just started, the score is 00 to 00. A game ends only when the point difference is greater than or equal to 22.

Note: Once a game ends, the next one starts immediately.

Your program should read a sequence of match information in the form of WL\texttt{WL} and output the correct results.

Input Format

The input consists of several lines, each being a string of uppercase W\texttt W, L\texttt L, and E\texttt E. The character E\texttt E indicates the end of the match information; the program should ignore everything after E\texttt E.

Output Format

The output has two parts. Each part contains several lines, and each line corresponds to the score of one game (in the order implied by the input record). The first part is the result under the 1111-point system, and the second part is the result under the 2121-point system. The two parts are separated by one blank line.

WWWWWWWWWWWWWWWWWWWW
WWLWE

11:0
11:0
1:1

21:0
2:1

Hint

  • Each line contains at most 2525 letters, and there are at most 25002500 lines.

【Admin Note】

This is a very early problem, and there are two issues in the test points. These are kept as-is on Luogu:

  1. One test point actually contains 25012501 lines.
  2. One test point includes characters other than W\texttt W, L\texttt L, and E\texttt E, which do not conform to the input format. However, those characters only appear after E\texttt E, and per the statement, all content after E\texttt E should be ignored.

【Problem Source】

NOIP 2003 Junior, Problem 1.

Translated by ChatGPT 5