#C14294. Counting Integer Frequencies

    ID: 43927 Type: Default 1000ms 256MiB

Counting Integer Frequencies

Counting Integer Frequencies

You are given a single line of input containing space-separated tokens. Some tokens may represent valid integers and others may not. Your task is to count the frequency of each valid integer and then output each integer along with its frequency.

Only tokens that can be interpreted completely as integers (including negative numbers) should be considered; all other tokens must be ignored.

The output should list each integer and its frequency on a separate line, with the integers sorted in ascending order.

Mathematically, if the input tokens are denoted by \( t_1, t_2, \ldots, t_n \), then for each token \( t_i \) that can be parsed as an integer \( k \), compute \[ f(k) = \text{number of occurrences of } k \] Output each such \( k \) with its frequency.

inputFormat

The input consists of a single line containing space-separated tokens. Each token is a string that might represent an integer.

outputFormat

For every token that can be converted entirely into an integer, output a single line with the integer and its frequency, separated by a space. The results must be printed in ascending order of the integer value. If no integers are found, produce no output.

## sample
1 2 a 1 3 4 2
1 2

2 2 3 1 4 1

</p>