Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits).
For eg.:
1234 can be read as one 2, three 4s - so, the output for 1234 is 2444.
643 has an odd number of digits, so a leading zero is added to make it even. Then, 0643 can be read as: zero 6s, four 3s, hence the output would be 3333.
(This is OEIS A056967).
Task: Given an array of positive integers, sort them by their digit-pair-described value, in ascending order. Order does not matter between input numbers that lead to the same value.
Input: an array/list/set of positive integers. Leading zeros in the input are not allowed, and input as strings/lists of digits/etc. are not allowed - the inputs should be as close to an integer/numeric type as your language is capable of using.
Output: the array sorted in the above-mentioned way, returned in any of the usual ways (function return value/STDOUT/shouting into the void/etc.) You can print them individually, return them as numbers, strings, or lists of digits.
Test cases
Input
Output
[19, 91, 2345, 2023]
[19, 2023, 2345, 91]
[25257, 725, 91, 5219, 146125, 14620512]
[725, 5219, 14620512, 91, 146125, 25257]
[123130415 3335 91 111111111 528 88]
[528, 111111111, 123130415, 3335, 88, 91]
[1 21 33 4 5]
[1 4 5 21 33]
[3725, 10, 2537, 1, 1225, 2512]
[10, 1, 1225, 2512, 2537, 3725]
[125, 26, 1115, 1024]
[1115, 1024, 125, 26]
(In the 4th test case, 1, 4, and 5 all evaluate to 0, and so can be sorted among themselves in any order. Similarly in the fifth test case, 10 and 1 both evaluate to 0s, and so can be sorted in either order.)
(Related: Say what you see, One 1, Two 1's, One 2 One 1
Thanks to Kevin Cruijssen for help clarifying the question in the Sandbox.
strtoi
returns an integer - correct? If so, that's fine, it's legal as it is. \$\endgroup\$