<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:
        # Initialize a list to count occurrences of each letter
        counts = [0] * 26
        for char in s:
            counts[ord(char) - ord('a')] += 1
        
        # Array to store the number of each digit
        nums = [0] * 10
        # Identify unique digits by unique characters
        nums[0] = counts[ord('z') - ord('a')]  # 'z' is unique to "zero"
        nums[2] = counts[ord('w') - ord('a')]  # 'w' is unique to "two"
        nums[4] = counts[ord('u') - ord('a')]  # 'u' is unique to "four"
        nums[6] = counts[ord('x') - ord('a')]  # 'x' is unique to "six"
        nums[8] = counts[ord('g') - ord('a')]  # 'g' is unique to "eight"
        
        # Identify remaining digits by adjusting for letters already counted
        nums[1] = counts[ord('o') - ord('a')] - nums[0] - nums[2] - nums[4]  # 'o' is in "one", "two", "four", "zero"
        nums[3] = counts[ord('h') - ord('a')] - nums[8]  # 'h' is in "three" and "eight"
        nums[5] = counts[ord('f') - ord('a')] - nums[4]  # 'f' is in "five" and "four"
        nums[7] = counts[ord('s') - ord('a')] - nums[6]  # 's' is in "seven" and "six"
        nums[9] = counts[ord('i') - ord('a')] - nums[5] - nums[6] - nums[8]  # 'i' is in "nine", "five", "six", "eight"
        
        # Build the final output string by repeating the digit based on the count
        result = []
        for i in range(10):
            result.append(str(i) * nums[i])
        
        return ''.join(result)

16700