Dsa
Strings
Warm-up
Character Frequency Count
You are given a string containing any characters. Your task is to count the frequency of each character in the string and print the result in the format 'character: frequency'. The output should be sorted by the characters in ascending order.
Example Input:
banana
Example Output:
b: 1
a: 3
n: 2
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