<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:
//0: zero
//1: one
//2: two
//3: three
//4: four
//5: five
//6: six
//7: seven
//8: eight
//9: nine
    string originalDigits(string s) {
        unordered_map<char, int> um;
        for(char c: s) um[c]++;
        vector<string> strs {
            "zero",//z
            "one",//n
            "two",//t
            "three",//h
            "four",//r
            "five",//f
            "six",//x
            "seven",//v
            "eight",//g
            "nine",//i
        };
        vector<int> count(10);
        if(0 < um['z']) {
            count[0] = um['z'];
            for(char c: strs[0]) um[c] -= count[0];
        }
        if(0 < um['x']) {
            count[6] = um['x'];
            for(char c: strs[6]) um[c] -= count[6];
        }
        if(0 < um['g']) {
            count[8] = um['g'];
            for(char c: strs[8]) um[c] -= count[8];
        }
        if(0 < um['h']) {
            count[3] = um['h'];
            for(char c: strs[3]) um[c] -= count[3];
        }
        if(0 < um['r']) {
            count[4] = um['r'];
            for(char c: strs[4]) um[c] -= count[4];
        }
        if(0 < um['f']) {
            count[5] = um['f'];
            for(char c: strs[5]) um[c] -= count[5];
        }
        if(0 < um['v']) {
            count[7] = um['v'];
            for(char c: strs[7]) um[c] -= count[7];
        }
        if(0 < um['i']) {
            count[9] = um['i'];
            for(char c: strs[9]) um[c] -= count[9];
        }
        if(0 < um['n']) {
            count[1] = um['n'];
            for(char c: strs[1]) um[c] -= count[1];
        }
        if(0 < um['t']) {
            count[2] = um['t'];
            for(char c: strs[2]) um[c] -= count[2];
        }

        string ans;
        for(int i = 0; i < 10; ++i) {
            if(0 < count[i]) {
                ans += string(count[i], '0' + i);
            }
        }
        return ans;
    }
};
12300