<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) {
        int count[26] = {}, resultCount[10] = {};
        for (char c : s)
            count[c - 'a']++;
        vector<tuple<char, char, string>> digits{
            {'0', 'z', "zero"},  {'2', 'w', "two"},   {'4', 'u', "four"},
            {'6', 'x', "six"},   {'8', 'g', "eight"}, {'1', 'o', "one"},
            {'3', 'r', "three"}, {'5', 'f', "five"},  {'7', 'v', "seven"},
            {'9', 'e', "nine"}};
        for (auto& digit : digits) {
            int digitCount = count[get<1>(digit) - 'a'];
            resultCount[get<0>(digit) - '0'] += digitCount;
            for (char c : get<2>(digit))
                count[c - 'a'] -= digitCount;
        }
        string result;
        for (int i = 0; i < 10; i++)
            result += string(resultCount[i], i + '0');
        return result;
    }
};
10900