# Ordinary Cardinals

Sorting can be performed meaningfully according to arbitrary comparison criteria, as long as those criteria satisfy the mathematical requirements of a **total ordering** relation. To play around with this concept to grok it, let us define a wacky ordering relation of positive integers so that for any two integers, the one that contains the digit 9 more times is considered to be larger, regardless of the magnitude and other digits of these numbers.

For example, `99 > 123456789 > 10`

in this ordering. If both integers contain the digit 9 the same number of times, the comparison proceeds to the next lower digit 8, and so on down there until the first distinguishing digit has been discovered. If both integers contain every digit from 9 to 0 pairwise the same number of times, the ^{10}**ordinary integer order** comparison determines their mutual ordering.

Your goal is to sort given sequence of integers according to this rule in ascending order. Let's see an additional example for `[111, 19, 919, 1199, 911, 999]`

input.

**Input:** List of integers (int).

**Output:** List of integers (int).

**Examples:**

assert sort_digit_count([99, 123456789, 10000000000]) == [10000000000, 123456789, 99] assert sort_digit_count([9876, 19, 4321, 99, 73, 241, 111111, 563, 33]) == [ 111111, 33, 241, 4321, 563, 73, 19, 9876, 99, ] assert sort_digit_count([111, 19, 919, 1199, 911, 999]) == [ 111, 19, 911, 919, 1199, 999, ] assert sort_digit_count([1234, 4321, 3214, 2413]) == [1234, 2413, 3214, 4321]

*The mission was taken from Python CCPS 109. It is taught for Ryerson Chang School of Continuing Education by Ilkka Kokkarinen*

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=py config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin

checkio install-plugin --ff

checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.