Lotto combinations X42565


Statement
 

pdf   zip

html

The organizers of the National Lotto need a program to store the bets. Each participant bets 6 numbers between 1 and 49. The organizers are interested (probably for obscure reasons) in finding out whether there are combinations more bet on than others.

The program must read the bets –which consist of the participant name followed by 6 numbers between 1 and 49– and print the most played combination(s) and the names of the participants that bet on each.

Input

The input consists of sequence of bets, each formed by the participant’s name (a string with no whitespaces) and six numbers between 1 and 49

Output

The output must be the number of bets on the most played combinations, and for each combination with the highest number of bets, the list of names who played that combination. Combinations should be sorted in their original order in the input data. Played numbers should be sorted ascendingly. Names playing each combination should be sorted alphabetically. Check the format of the examples.

Public test cases
  • Input

    john 1 5 12 8 33 22
    mary 9 4 7 41 21 11
    peter 1 5 8 12 23 45
    jessica 11 22 33 44 5 6
    
    
    
    
    

    Output

    Most played combinations were bet 1 times
    Bet 1 5 8 12 22 33 was played by: john
    Bet 4 7 9 11 21 41 was played by: mary
    Bet 1 5 8 12 23 45 was played by: peter
    Bet 5 6 11 22 33 44 was played by: jessica
    
  • Input

    john 1 5 12 8 33 22
    mary 9 4 7 41 21 11
    peter 1 5 8 12 23 45
    jessica 11 22 33 44 5 6
    sylvia 12 23 8 45 5 1
    john 9 4 7 41 21 11
    peter 5 1 45 8 23 12
    james 6 5 22 33 11 44
    sheila 4 8 11 28 41 13
    
    
    
    

    Output

    Most played combinations were bet 3 times
    Bet 1 5 8 12 23 45 was played by: peter sylvia
    
  • Input

    john 1 5 12 8 33 22
    mary 9 4 7 41 21 11
    peter 1 5 8 12 23 45
    jessica 11 22 33 44 5 6
    sylvia 12 23 8 45 5 1
    john 9 4 7 41 21 11
    james 6 5 22 33 11 44
    sheila 4 8 11 28 41 13
    
    
    

    Output

    Most played combinations were bet 2 times
    Bet 4 7 9 11 21 41 was played by: john mary
    Bet 1 5 8 12 23 45 was played by: peter sylvia
    Bet 5 6 11 22 33 44 was played by: james jessica
    
  • Information
    Author
    Lluís Padró
    Language
    English
    Official solutions
    Python
    User solutions
    Python