Question bank › Strings
Dsa Strings Easy

Character Frequency Counter

Write a program that counts the frequency of each character in a given string. Your program should ignore spaces and be case-insensitive. The output should be a list of characters and their counts, each on a new line in the format 'char:count'. Characters should be printed in alphabetical order. If a character appears more than once, its count should be represented as the total number of appearances. Example Input: Hello World Example Output: e:1 H:1 l:3 o:2 r:1 W:1

Key concepts

stringscountingfrequency

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 InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.