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

static constexpr std::string_view start_nums[]{
    "One",     "Two",       "Three",    "Four",     "Five",
    "Six",     "Seven",     "Eight",    "Nine",     "Ten",
    "Eleven",  "Twelve",    "Thirteen", "Fourteen", "Fifteen",
    "Sixteen", "Seventeen", "Eighteen", "Nineteen",
};

static constexpr std::string_view ten_nums[] = {
    "Twenty", "Thirty",  "Forty",  "Fifty",
    "Sixty",  "Seventy", "Eighty", "Ninety",
};

static constexpr std::string_view three_group_names[]{"", "Thousand", "Million",
                                                      "Billion"};

class Solution {
public:
    string numberToWords(const uint32_t full_num) {
        if (full_num == 0)
            return "Zero";

        std::string res;

        for (uint32_t three_group = 3u, ten_power = 1000000000u; ten_power > 0;
             --three_group, ten_power /= 1000u) {

            const uint32_t num = full_num / ten_power;
            if (num == 0 || num % 1000u == 0)
                continue;

            const uint32_t hundreds = num / 100u % 10u;
            if (hundreds > 0) {
                res += start_nums[hundreds - 1];
                res += " ";
                res += "Hundred";
                res += " ";
            }

            const uint32_t tens = num % 100u;
            if (tens == 0) {
            } else if (tens <= 19) {
                res += start_nums[tens - 1];
                res += " ";
            } else {
                res += ten_nums[tens / 10u - 2u];
                res += " ";
                const uint32_t ones = tens % 10u;
                if (ones > 0u) {
                    res += start_nums[ones - 1u];
                    res += " ";
                }
            }

            res += three_group_names[three_group];
            res += " ";
        }

        while (!res.empty() && res.back() == ' ')
            res.pop_back();

        return res;
    }
};
7900