#K66757. Unique Characters Frequency Counter

    ID: 32491 Type: Default 1000ms 256MiB

Unique Characters Frequency Counter

Unique Characters Frequency Counter

Given a string, your task is to count the frequency of each character while ignoring all spaces and treating uppercase and lowercase letters as the same. The output should be a dictionary (or equivalent in other languages) printed in a specific format with the characters sorted in ascending order.

In other words, if a string s is provided, you must:

  • Convert all letters to lowercase.
  • Remove all spaces.
  • Count the occurrences of every character.
  • Output the result in a dictionary-like format with keys sorted in ascending order.

The dictionary output format must follow the LaTeX style for formulas where necessary. For example, the output for the string "Hello World" should be formatted as:

\(\{'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1\}\)

This problem tests your ability to perform string manipulation, use data structures for counting, and ensure consistent output ordering.

inputFormat

The input is provided via stdin and consists of a single line containing the string \( s \). The string can include letters, digits, symbols and spaces.

Note: The input string may be empty.

outputFormat

Output a single line to stdout representing the dictionary of character frequencies. The dictionary should be formatted as follows: keys (characters) enclosed in single quotes, a colon, a space, and their corresponding frequency. The key-value pairs should be separated by commas and a space, and the entire output should be enclosed in curly braces. The characters must be sorted in ascending order (based on their ASCII values).

For example, for input Hello World, the correct output is:

\(\{'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1\}\)

## sample
Hello World
{'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}