| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 19 | 11 | 11 | 61.111% |
The programmers of a TTS (text-to-speech) program have discovered that their product does a poor job of reading numbers written in conventional numeric form. Currently, it just announces each digit in the number, one after the other, which gets confusing to the listener after a few digits have gone by.
They would prefer to have a more natural reading of numbers, and one of them has suggested that, if they convert numeric strings into the appropriate text equivalent, e.g., convert "1023ドル$" into "one thousand and twenty three", then their speech engine will be able to handle the reading with no further modification.
Write a program to carry out the transformation of non-negative integers into conventional English wording:
Input will consist of one or more datasets. Each dataset will consist of a single line containing a non-negative integer in the range 0ドル\ldots 999,999円,999円$. Although we have used commas within digit strings for clarity in this problem description, there will be no commas in the input. There will be no leading zeros on positive input numbers.
A line with a negative value signals the end of input.
For each dataset, print a single line containing the spelled-out equivalent of the number, according to the rules above.
Formatting requirements:
1 222143 1000001 -1
one two hundred and twenty-two thousand, one hundred and forty-three one million and one