Histogram by the Hundreds X91984


Statement
 

pdf   zip

html

Write a program that reads a sequence of nonnegative integers and reports the histogram by the hundreds: write out how many numbers were between 0 and 99, how many between 100 and 199, how many between 200 and 299, and so on.

Input

The data sequence is to be provided completely in a single line, with spaces separating the consecutive numbers.

Output

For each interval [N, M], where N is a multiple of 100 and M = N + 99, such that some value in the input sequence belongs to the interval, write a line reporting the interval (with its square brackets and its comma and space), immediately followed by a colon and a space, and then the quantity of numbers in the input falling within that interval. The intervals must be ordered according to their left endpoint N.

Public test cases
  • Input

    7483 1398745 11243 42 135 35 53 134 2436 246 256 3464 57 457 387 380

    Output

    [0, 99]: 4
    [100, 199]: 2
    [200, 299]: 2
    [300, 399]: 2
    [400, 499]: 1
    [2400, 2499]: 1
    [3400, 3499]: 1
    [7400, 7499]: 1
    [11200, 11299]: 1
    [1398700, 1398799]: 1
    
  • Input

    1 2 3 4 5 6 7 8 9 100

    Output

    [0, 99]: 9
    [100, 199]: 1
    
  • Information
    Author
    José Luis Balcázar
    Language
    English
    Official solutions
    Python
    User solutions
    Python