<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:
        # Step 1: Count characters
        count = [0] * 26
        for c in s:
            count[ord(c) - ord('a')] += 1
        
        # Step 2: Identify digits based on unique characters
        digit_count = [0] * 10
        digit_count[0] = count[ord('z') - ord('a')]  # zero
        digit_count[2] = count[ord('w') - ord('a')]  # two
        digit_count[4] = count[ord('u') - ord('a')]  # four
        digit_count[6] = count[ord('x') - ord('a')]  # six
        digit_count[8] = count[ord('g') - ord('a')]  # eight
        
        # Step 3: Subtract counts for identified digits
        digit_count[1] = count[ord('o') - ord('a')] - digit_count[0] - digit_count[2] - digit_count[4]  # one
        digit_count[3] = count[ord('h') - ord('a')] - digit_count[8]  # three
        digit_count[5] = count[ord('f') - ord('a')] - digit_count[4]  # five
        digit_count[7] = count[ord('s') - ord('a')] - digit_count[6]  # seven
        digit_count[9] = count[ord('i') - ord('a')] - digit_count[5] - digit_count[6] - digit_count[8]  # nine
        
        # Step 4: Construct the result string
        result = []
        for i in range(10):
            result.extend([str(i)] * digit_count[i])
        
        return ''.join(result)

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