P1042 [NOIP 2003 Junior] Table Tennis

Background

国际乒联现在主席沙拉拉自从上任以来就立志于推行一系列改革,以推动乒乓球运动在全球的普及。其中 $11$ 分制改革引起了很大的争议,有一部分球员因为无法适应新规则只能选择退役。华华就是其中一位,他退役之后走上了乒乓球研究工作,意图弄明白 $11$ 分制和 $21$ 分制对选手的不同影响。在开展他的研究之前,他首先需要对他多年比赛的统计数据进行一些分析,所以需要你的帮忙。

Description

Huahua analyzes the match in the following way: first, list the outcome of each rally, then compute the match results under the $11$-point system and the $21$-point system (up to the end of the record). For example, consider the following record (where $\texttt W$ means Huahua scores a point, and $\texttt L$ means Huahua’s opponent scores a point): $$\texttt{WWWWWWWWWWWWWWWWWWWWWWLW}$$ Under the $11$-point system, Huahua wins game $1$ by $11$ to $0$, wins game $2$ by $11$ to $0$, and game $3$ is in progress with the current score $1$ to $1$. Under the $21$-point system, Huahua wins game $1$ by $21$ to $0$, and game $2$ is in progress with the score $2$ to $1$. If a game has just started, the score is $0$ to $0$. A game ends only when the point difference is greater than or equal to $2$. Note: Once a game ends, the next one starts immediately. Your program should read a sequence of match information in the form of $\texttt{WL}$ and output the correct results.

Input Format

The input consists of several lines, each being a string of uppercase $\texttt W$, $\texttt L$, and $\texttt E$. The character $\texttt E$ indicates the end of the match information; the program should ignore everything after $\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 $11$-point system, and the second part is the result under the $21$-point system. The two parts are separated by one blank line.

Explanation/Hint

- Each line contains at most $25$ letters, and there are at most $2500$ 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 $2501$ lines. 2. One test point includes characters other than $\texttt W$, $\texttt L$, and $\texttt E$, which do not conform to the input format. However, those characters only appear after $\texttt E$, and per the statement, all content after $\texttt E$ should be ignored. 【Problem Source】 NOIP 2003 Junior, Problem 1. Translated by ChatGPT 5