Given a whole number num, return how it is written out in English words, following the rules below exactly.
The words you may use, each starting with a capital letter:
ZeroOne Two Three Four Five Six Seven Eight NineTen Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eighteen NineteenTwenty Thirty Forty Fifty Sixty Seventy Eighty NinetyHundred Thousand Million BillionHow to build the answer:
Billion, Million or Thousand (the ones group has none). A group that is all zeros is left out completely, scale word and all.Hundred. Then the last two digits: from 1 to 19 they are a single word; from 20 to 99 they are a tens word, followed by the ones digit's word if that digit isn't zero. When the last two digits are 00, write nothing for them.0 is the only number written as Zero.
The hundreds digit gives Four Hundred. The last two digits are 05, which is just Five.
The groups are 7 and 013. 7 thousand, then 13 is one word of its own.
The groups are 2, 000, 050 and 019. The millions group is zero, so it doesn't appear at all.
Constraints
0 <= num <= 2³¹ - 1 (that is, 2147483647)Every group of three digits is said the same way; only the scale word after it changes. Solve 1 to 999 once and reuse it.
405