Convert a non-negative integer `num` to its English words representation, for example `12345` becomes `"Twelve Thousand Three Hundred Forty Five"`. Words are capitalised and separated by single spaces, with no "and" and no hyphens.
Convert a non-negative integer num to its English words representation, for example 12345 becomes "Twelve Thousand Three Hundred Forty Five". Words are capitalised and separated by single spaces, with no "and" and no hyphens.
Example 1:
Input: {"num":123}
Output: One Hundred Twenty Three
Constraints:
0≤num≤231−1
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"num":123}
num = 123
split into groups
1
2
3
units
num left in the loop
123
Read 123 in groups of three digits, as you would with commas: each group is a number below 1000 followed by a scale word.