Dsa
Math
Warm-up
Count Digits
Given a positive integer, count how many times each digit appears in it and print the result in a sorted order of digits.
Input format:
- A single line containing a positive integer.
Output format:
- A list of space-separated strings in the format 'digit:count' sorted by digit.
Example:
Input:
112233
Output:
1:2 2:2 3:2
Key concepts
mathstringscounting
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