#P1042. Match Analysis Based on Scoring Systems

    ID: 12430 Type: Default 1000ms 256MiB

Match Analysis Based on Scoring Systems

Match Analysis Based on Scoring Systems

Given a record of points in a match represented by a string consisting of the characters W and L (where W indicates that Huahua won a point and L indicates that the opponent won a point), you are to simulate the match under two scoring systems: the 11-point system and the 21-point system.

For each scoring system, the match is divided into games. In each game, points are accumulated from the record. A game is finished immediately when the following conditions are satisfied:

  • At least one side has reached the threshold (either 11 or 21 as applicable) and
  • The absolute difference between the two scores is at least 2, i.e. \( |a-b| \ge 2 \).

When a game finishes, the next game starts immediately with both scores reset to 0. If a game has not finished by the end of the record, output its current score. Note that if a game has not yet started any scoring, its score is considered \(0-0\).

Example:

Consider the input record:

WWWWWWWWWWWWWWWWWWWWWWLW

This record should be interpreted as follows:

  • 11-point system: The first 11 characters give a score of \(11-0\) (game completed), the next 11 characters give another \(11-0\) (game completed), and the remaining 2 characters (which are L and W) result in an ongoing game with a score of \(1-1\). Thus, the result is:
11: 11-0, 11-0, 1-1
  • 21-point system: The first 21 characters yield \(21-0\) (game completed), and the remaining 3 characters yield an ongoing game with a score of \(2-1\). Thus, the result is:
21: 21-0, 2-1

Your task is to read the input record and output two lines: the first line contains the result for the 11-point system prefixed with "11: " and the second line for the 21-point system prefixed with "21: ". The scores of each game should be separated by a comma and a space.

Note: Any formulas must be expressed in LaTeX. For instance, the victory condition must be written as \( |a-b| \ge 2 \).

inputFormat

The input consists of a single non-empty string composed only of the characters W and L (without spaces and quotes), representing the sequence of points in the match.

outputFormat

Output two lines:

  • The first line should begin with 11: followed by the game scores for the 11-point system.
  • The second line should begin with 21: followed by the game scores for the 21-point system.

The score for each game is represented as a-b where a is Huahua's score and b is the opponent's score. Games are separated by a comma and a space.

sample

WWWWWWWWWW
11: 10-0

21: 10-0

</p>