Dsa
Sorting
Easy
Employee ID Registry
You are given a list of employee IDs. Each ID consists of letters followed by digits (like 'abc123', 'xyz456'). Your task is to sort these IDs first by the numeric part in ascending order and then by the alphabetical part. Input will be multiple lines, each containing one employee ID. Output the sorted list of IDs, one per line.
Example:
Input:
xyz456
abc123
abc789
xyz123
Output:
abc123
xyz123
xyz456
abc789
Key concepts
sortingstrings
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