#K38797. Character Frequency Count

    ID: 26278 Type: Default 1000ms 256MiB

Character Frequency Count

Character Frequency Count

You are given a string S. Your task is to count the frequency of each character present in the string and print the result. For each character that appears in the string, output a line with the character, a space, and its frequency. The characters must be printed in lexicographically sorted order.

For example, if the input string is "apple", the frequencies are:

  • a: 1
  • e: 1
  • l: 1
  • p: 2

If the input is an empty string, no output should be produced.

The frequency count should be computed considering all characters in the input.

inputFormat

The input consists of a single line containing the string S.

outputFormat

Print the frequency of each character in S on separate lines. Each line should contain the character and its frequency separated by a single space. The output should list the characters in lexicographically sorted order. If the input string is empty, print nothing.

## sample
apple
a 1

e 1 l 1 p 2

</p>