📘
Character Frequency Counter
EasyText Processing
Given a string, count the frequency of each character (case-insensitive, ignoring spaces) and return the result as a sorted dictionary.
Example:
- Input: "Hello World"
- After lowering and removing spaces: "helloworld"
- Frequencies: {'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}
Example:
Input:
Hello World
Output:
{'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}Reasoning:
Step 1: Lowercase and remove spaces "Hello World" → "helloworld"
Step 2: Count each character h:1, e:1, l:3, o:2, w:1, r:1, d:1
Step 3: Sort by key {'d': 1, 'e': 1, 'h': 1, 'l': 3, 'o': 2, 'r': 1, 'w': 1}
Constraints:
- Input: A single line of text
- Case-insensitive (convert to lowercase)
- Ignore spaces
- Output: Dictionary with characters sorted alphabetically
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.