<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>

class Solution {
public:
    string numberToWords(int n) {
        if (!n)
            return "Zero";

        const vector<string> a = {"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"};
        const vector<string> b = {"", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"};
        const vector<string> c = {"", "Thousand", "Million", "Billion"};

        string res = "";
        int j = 0;

        while (n) {
            int cur = n % 1000;
            string s = "";
            n /= 1000;
            if (!cur) {
                j++;
                continue;
            }
            
            if (cur >= 100) {
                s += a[cur / 100] + " Hundred ";
                cur %= 100;
            }

            if (cur >= 20) {
                s += b[cur / 10] + " ";
                cur %= 10;
            }

            if (cur >= 1) {
                s += a[cur] + " ";
            }
            s += c[j++] + " ";
            res = s + res;
        }
        while (res.back() == ' ')
            res.pop_back();
        return res;
    }
};
11000