Description

Convert a non-negative integer num to its English words representation. Handle values up to 2^31 - 1 with Thousand, Million, Billion.

Examples

Input:num = 1234567
Output:"One Million Two Hundred Thirty Four Thousand Five Hundred Sixty Seven"
Explanation:

Convert to words.

Input:num = 0
Output:Zero
Explanation:

The edge case where the input is zero should return 'Zero' as the English word representation.

Input:num = 50301
Output:Fifty Thousand Three Hundred One
Explanation:

This example demonstrates handling numbers with zeros in the middle. The zero in the tens place of 50301 is skipped, avoiding phrases like 'Three Hundred Zero One'. The correct output is 'Fifty Thousand Three Hundred One'.

Constraints

  • 0 ≤ num ≤ 2³¹ - 1

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!