<p>Convert a non-negative integer <code>num</code> to its English words representation.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> num = 123
<strong>Output:</strong> &quot;One Hundred Twenty Three&quot;
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> num = 12345
<strong>Output:</strong> &quot;Twelve Thousand Three Hundred Forty Five&quot;
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> num = 1234567
<strong>Output:</strong> &quot;One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven&quot;
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= num &lt;= 2<sup>31</sup> - 1</code></li>
</ul>

constexpr array<char*, 27> english_numbers = {
    "One",      "Two",      "Three",   "Four",    "Five",      "Six",
    "Seven",    "Eight",    "Nine",    "Ten",     "Eleven",    "Twelve",
    "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",
    "Nineteen", "Twenty",   "Thirty",  "Forty",   "Fifty",     "Sixty",
    "Seventy",  "Eighty",   "Ninety"};

class Solution {
    void small(const int n, string& result) const {
        if (result.length())
            result += ' ';
        result += english_numbers[n - 1];
    }

    void medium(int n, string& result) const {
        if (99 < n) {
            small(n / 100, result);
            result += " Hundred";
            n %= 100;
        }
        if (20 < n) {
            if (result.length())
                result += ' ';
            result += english_numbers[(n / 10) + 17];
            n %= 10;
        }
        if (n)
            small(n, result);
    }

    void big(int& n, const int m, string& result, string_view output) const {
        if (m <= n) {
            medium(n / m, result);
            result += ' ';
            result += output;
            n %= m;
        }
    }

public:
    string numberToWords(int n) const {
        if (!n)
            return "Zero";
        string result;
        big(n, 1000000000, result, "Billion");
        big(n, 1000000, result, "Million");
        big(n, 1000, result, "Thousand");
        medium(n, result);
        return result;
    }
};
7600