We all know of different fancy sorting algorithms, but none of these give us numbers in a way that's easy to pronounce. To remedy this, I propose using PronunciationSort™, the most natural way to sort lists of numbers.
The official rules for pronouncing numbers (in this challenge) is that the digits are pronounced one by one, and the resulting string is sorted in lexicographic order. As an example, this means that the number
845 is pronounced
"eight four five", and should be sorted accordingly.
Negative numbers are pronounced by prepending the word
-23 is pronounced as
"minus two three". Note that this causes negative numbers to end up in the middle of the output, right between numbers starting with
4 (four) and
As a guide, the official order of words for PronunciationSort™ is:
8, 5, 4, -, 9, 1, 7, 6, 3, 2, 0
A list of integers in the range \$[-999, 999]\$, containing at most 100 elements. Input as a list of strings is not permitted. If your language does not support input as list, it is permissible to give input as separate integers.
The input will not contain any invalid numbers, or any number starting with a 0 (except the number 0 itself). The input will generally not be sorted, it can be given in any order.
The same integers, in PronunciationSort™ order. Note that the numbers should only be converted to their pronunciations to get the sorting, the output should not contain any strings.
For the examples, the middle step (wrapped in parentheses) only serves as a guide, and is not a part of the output.
[1, 2, 3] -> (['one', 'two', 'three']) -> [1, 3, 2] [-1, 0, 1, 2] -> (['minus one', 'zero', 'one', 'two']) -> [-1, 1, 2, 0] [-100, 45, 96] -> (['minus one zero zero', 'four five', 'nine six']) -> [45, -100, 96] [11, 12, 13, 134, 135] -> (['one one', 'one two', 'one three', 'one three four', 'one three five']) -> [11, 13, 135, 134, 12]
There's also a script for verifying your results.