Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: sort mixed string 2

Take the above example and change it so now we'll take in account the letter too. Sort the strings based on the first letter, and among values with the same leading letter, sort them according to the numbers.

Input

A4
B1
A3
A27

Expected output

A3
A4
A27
B1

Expected output from sample file

A1
A3
A27
A38
B1
B3
B12
C1