#K79012. Letter Frequency

    ID: 35214 Type: Default 1000ms 256MiB

Letter Frequency

Letter Frequency

Given a string s, your task is to determine the frequency of each alphabetic character while ignoring non-letter characters. Treat uppercase and lowercase letters as the same (i.e. convert all letters to lowercase).

Once the frequency of each letter is computed, the letters should be sorted primarily by their frequency in decreasing order. In cases where multiple letters have the same frequency, preserve the order of their first appearance in the filtered string.

Note: The input string is provided through standard input (stdin). The output should list each letter and its frequency on a separate line to standard output (stdout), with the letter and its count separated by a space.

Example:

Input:
Hello, World!

Output: l 3 o 2 h 1 e 1 w 1 r 1 d 1

</p>

inputFormat

The input consists of a single line containing a string s. The string may contain letters, digits, spaces, and other special characters.

outputFormat

For each distinct letter (in lowercase) found in the input, output a line containing the letter and its frequency separated by a space. The letters must be ordered first by decreasing frequency, then by the order of their first occurrence in the filtered (lowercase alphabetic only) string.

## sample
Hello, World!
l 3

o 2 h 1 e 1 w 1 r 1 d 1

</p>