Problem list
Log in
#r03520 · CCC 2016 Junior

Tournament Selection

Bronze IV 2.0 s 256 MB

Each player in a tournament plays six games. There are no ties. The tournament director places the players in groups based on the results of games as follows:

  • if a player wins 5 or 6 games, they are placed in Group 1;

  • if a player wins 3 or 4 games, they are placed in Group 2;

  • if a player wins 1 or 2 games, they are placed in Group 3;

  • if a player does not win any games, they are eliminated from the tournament.

Write a program to determine which group a player is placed in.

Input

The input consists of six lines, each with one of two possible letters: W (to indicate a win) or L (to indicate a loss).

Output

The output will be either 1, 2, 3 (to indicate which Group the player should be placed in) or -1 (to indicate the player has been eliminated).

Example 1

Input
W
L
W
W
L
W
Output
2

Example 2

Input
L
L
L
L
L
L
Output
-1
Source
CCC 2016 Junior
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code