#C14758. Frequency Count of List Elements

    ID: 44442 Type: Default 1000ms 256MiB

Frequency Count of List Elements

Frequency Count of List Elements

You are given an input from stdin consisting of a single line that represents a JSON array. Your task is to count the frequency of each unique integer in the array and output a dictionary formatted as {key: value, ...} with keys sorted in ascending order.

Important conditions:
1. If the array is empty, output exactly: List is empty.
2. If any element in the array is not an integer, output exactly: List contains non-integer values.
3. If the input is not a JSON array, output exactly: Input should be a list of integers.

The output must be printed to stdout.

inputFormat

Input is provided via stdin as a single line containing a JSON array. For example: [1, 2, 2, 3, 4, 4, 4, 5]

outputFormat

If the input is valid, print a dictionary in the format {key: value, ...} with keys in ascending order. Otherwise, print the corresponding error message as specified.## sample

[1, 2, 2, 3, 4, 4, 4, 5]
{1: 1, 2: 2, 3: 1, 4: 3, 5: 1}