#C12832. Frequency Count

    ID: 42303 Type: Default 1000ms 256MiB

Frequency Count

Frequency Count

Given an input representing a list of elements, your task is to count the frequency of each unique integer in the list. If the input is valid, output a dictionary where each key is an integer from the list and its value is the number of times it occurs. If the input is not a proper list, output Error: Input should be a list.. Moreover, if the list contains any non-integer elements, output Error: List should only contain integers..

You can use the formula \(f(x)=\text{number of occurrences of } x\) to compute the frequency. The input is provided via standard input (stdin) and your output must be printed to standard output (stdout) exactly in the format specified in the examples.

inputFormat

The input is a single line from standard input. It should represent a list in the following format: [element1, element2, ...]. For example, a valid input might be [1, 2, 2, 3, 3, 3, 4] or [] (an empty list). The input may also be invalid, such as a plain string (e.g. not a list) or a list with non-integer elements (e.g. [1, 2, "three", 4]).

outputFormat

If the input is a valid list containing only integers, output a dictionary showing the frequency of each integer. The dictionary should be formatted as shown in the examples (e.g. {1: 1, 2: 2, 3: 3, 4: 1}). If the input is not a list, output Error: Input should be a list.. If the list contains non-integer elements, output Error: List should only contain integers..

## sample
[1, 2, 2, 3, 3, 3, 4]
{1: 1, 2: 2, 3: 3, 4: 1}