Dsa
Hashing
Easy
Character Frequency Sorter
You are given a string containing lowercase letters. Your task is to sort the characters in the string based on their frequency in descending order. If two characters have the same frequency, sort them in ascending order alphabetically.
Input Format:
A single line containing the input string.
Output Format:
Print the characters sorted by frequency criteria in a single line.
Example:
Input:
aabbccc
Output:
ccba
Key concepts
hashingstringssorting
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