Christmas raffle P51499


Statement
 

pdf   zip

thehtml

After playing the Christmas raffle and not winning anything, you suspect that the numbers are not drawn with the expected frequency. To study this, write a program to count the number of appearences of each number, and also to keep the most frequent number and the most frequent two-digit ending.

Input

Input consists of several cases. Every case consists of a non empty sequence of numbers between 0 and 109 ending with −1.

Output

For every case, after each number, print the most frequent number so far (if there is a tie, the smallest one), its number of occurrences, the two-digit ending most frequent so far (if there is a tie, the smallest one), and its number of occurrences. Print the endings always with two digits. Afterwards, print an empty line, followed by all the numbers in the input sorted in increasing order, with their number of accurrences. Print a line with 10 dashes at the end of every case.

Public test cases
  • Input

    1234
    142
    842
    1234
    -1
    9
    9
    0
    0
    9
    -1
    999999999
    888888899
    777777799
    -1
    

    Output

    1234 1 34 1
    142 1 34 1
    142 1 42 2
    1234 2 34 2
    
    142 1
    842 1
    1234 2
    ----------
    9 1 09 1
    9 2 09 2
    9 2 09 2
    0 2 00 2
    9 3 09 3
    
    0 2
    9 3
    ----------
    999999999 1 99 1
    888888899 1 99 2
    777777799 1 99 3
    
    777777799 1
    888888899 1
    999999999 1
    ----------
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python