<p>Given a string <code>s</code> containing an out-of-order English representation of digits <code>0-9</code>, return <em>the digits in <strong>ascending</strong> order</em>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> s = "owoztneoer"
<strong>Output:</strong> "012"
</pre><p><strong class="example">Example 2:</strong></p>
<pre><strong>Input:</strong> s = "fviefuro"
<strong>Output:</strong> "45"
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
	<li><code>s[i]</code> is one of the characters <code>[&quot;e&quot;,&quot;g&quot;,&quot;f&quot;,&quot;i&quot;,&quot;h&quot;,&quot;o&quot;,&quot;n&quot;,&quot;s&quot;,&quot;r&quot;,&quot;u&quot;,&quot;t&quot;,&quot;w&quot;,&quot;v&quot;,&quot;x&quot;,&quot;z&quot;]</code>.</li>
	<li><code>s</code> is <strong>guaranteed</strong> to be valid.</li>
</ul>

class Solution:
    def originalDigits(self, s: str) -> str:
        # Count each char in s.
        cnts = [0] * 10
        for c in s:
            if c == 'z': cnts[0] += 1
            if c == 'o': cnts[1] += 1
            if c == 'w': cnts[2] += 1
            if c == 'h': cnts[3] += 1 # only for 'three'
            if c == 'u': cnts[4] += 1
            if c == 'f': cnts[5] += 1 # only for 'five'
            if c == 'x': cnts[6] += 1
            if c == 's': cnts[7] += 1 # only for 'seven'
            if c == 'g': cnts[8] += 1
            if c == 'i': cnts[9] += 1 # for 'nine'

        # Build the number occurrences from the counts of unique characters.
        cnts[1] -= cnts[0] + cnts[2] + cnts[4]
        cnts[3] -= cnts[8]
        cnts[5] -= cnts[4]
        cnts[7] -= cnts[6]
        cnts[9] = cnts[9] - cnts[5] - cnts[6] - cnts[8]

        # Convert the counts back into a string with the digits in ascending order.
        result = ''
        for digit, count in enumerate(cnts):
            result += str(digit) * count
        return result

# Example usage:
sol = Solution()
print(sol.originalDigits("owoztneoer"))  # Output: "012"
print(sol.originalDigits("fviefuro"))    # Output: "45"
16800