BINGO - Bullshit Bingo

no tags 

Bullshit Bingo is a game to make lectures, seminars or meetings less boring. Every player has a card with 5 rows and 5 columns. Each of the 25 cells contains a word (the cell in the middle has always the word "BINGO" written in it). Whenever a player hears a word which is written on his card, he can mark it. The cell in the middle is already marked when the game starts. If a player has marked all the words in a row, a column or a diagonal, he stands up and shouts "BULLSHIT". After this, the game starts over again.

Sitting in a lecture, you observe that some students in the audience are playing Bullshit Bingo. You wonder what the average number of different words is until "BULLSHIT" is exclaimed. For the purpose of this problem, a word consists of letters of the English alphabet ('a' to 'z' or 'A' to 'Z'). Words are separated by characters other than letters (for example spaces, digits or punctuation). Do the comparison of words case-insensitively, i.e. "Bingo" is the same word as "bingo". When counting the number of different words, ignore the word BULLSHIT (indicating the end of the game), and consider only the words of the current game, i.e., if a word has already occurred in a previous game, you may still count it in the current game. If the last game is unfinished, ignore the words of that game.

Input Specification

The input file consists of the text of the lecture, with "BULLSHIT" occurring occasionally. The first game starts with the first word in the input. Each occurrence of "BULLSHIT" indicates the end of one game.
You may assume, that

  • the word "BULLSHIT" occurs only in uppercase letters
  • every word has at most 25 characters, and each line has at most 100 characters
  • there are at most 500 different words before a game ends
  • the players follow the rules, so there is no need to check if a game is valid or not
  • at least one game is completed

Output Specification

The output consists of one number: the average number of different words needed to win a game. Write the number as a reduced fraction in the format shown below. Reduced fraction means that there should be no integer greater than 1 which divides both the numerator and denominator. For example if there were 10 games, and the number of different words in each game summed up to 55, print "11 / 2".

Sample Input

Programming languages can be classified BULLSHIT into following types:
- imperative and BULLSHIT procedural languages
- functional languages
- logical BULLSHIT programming languages
- object-oriented BULLSHIT languages

Sample Output

9 / 2

In the sample input, there are 4 completed games. The number of different words is 5, 5, 4 and 4, respectively.

hide comments
nadstratosfer: 2017-08-24 18:41:58

Don't use Fractions module to reduce in Python. Also, no need to check for "gluedtoBULLSHIT" cases.

minhthai: 2016-03-14 11:16:37

This game should be played in every classroom!

Rishabh: 2015-07-17 13:38:59

AC in 1 go with python

vivek keshore: 2015-05-26 13:27:07

Very easy in python.

Abhimanyu: 2014-01-08 20:07:38

very nice game !

Adrian Kuegel: 2011-08-24 11:17:45

You read until EOF. Depending on the programming language you use, it is detected differently, so you may have to look it up.

Apoorv Upreti: 2011-08-23 04:16:09

How do I tell when all the data has been input? The input consists of multiple lines after all.

যোবায়ের: 2009-09-08 21:06:00

Nice game!

Added by:Adrian Kuegel
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS PERL6 VB.NET
Resource:University of Ulm Local Contest 2005