<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 {
public:
    string originalDigits(string s) {
        unordered_map<char, int> chars;
        vector<int> result(10, 0);
        string resultString;
        for (auto ch : s) {
            chars[ch]++;
        }
        while (chars['z'] > 0) {
            chars['z']--;
            chars['r']--;
            chars['o']--;
            result[0]++;
        }
        while (chars['w'] > 0) {
            chars['w']--;
            chars['o']--;
            result[2]++;
        }
        while (chars['u'] > 0) {
            chars['f']--;
            chars['o']--;
            chars['u']--;
            chars['r']--;
            result[4]++;
        }
        while (chars['o'] > 0) {
            chars['o']--;
            chars['n']--;
            result[1]++;
        }
        while (chars['r'] > 0) {
            chars['r']--;
            result[3]++;
        }
        while (chars['f'] > 0) {
            chars['f']--;
            result[5]++;
        }
        while (chars['x'] > 0) {
            chars['s']--;
            chars['x']--;
            result[6]++;
        }
        while (chars['s'] > 0) {
            chars['s']--;
            chars['n']--;
            result[7]++;
        }
        while (chars['g'] > 0) {
            chars['g']--;
            result[8]++;
        }
        while (chars['n'] > 0) {
            chars['n']-=2;
            result[9]++;
        }
        for (int i = 0; i < result.size(); i++) {
            while (result[i] > 0) {
                resultString+=to_string(i);
                result[i]--;
            }
        }
        return resultString;
    }
};
12900