Question bank › Strings
Dsa Strings Easy

Character Frequency Dictionary

Write a program that takes a string and outputs a frequency dictionary of the characters in it. Ignore spaces, and treat uppercase and lowercase characters as the same. The output should display characters and their counts sorted by the character. Input Format: - A single line containing the input string. Output Format: - A sorted list of characters with their counts in the format 'character: count'. Each on a new line. Example: Input: banana Output: b: 1 a: 3

Key concepts

stringscountingdictionary

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.