NUMWORD - Number to Word

no tags 

In this task you just need to convert a number from its digit form to word form.

For example, you should output 'one' for 1, 'thirty seven thousand' for 37000.

You can assume that input will be >= 0 and <= 50000.

Also all numbers will be valid i.e. input will not have numbers like 023.

Input

Input contains one line which is n, 0 <= n <= 50,000.

Output

Output the number in words as specified.

Example

Input:
123
34108

Output:
one hundred twenty three
thirty four thousand one hundred eight

Score: source code length.

Problem was modified on 23/2/2011. Many other languages added as users want, and problem statement changed which lead to no accepted solutions and that is because increasing in test cases number.


hide comments
david_8k: 2012-07-16 22:04:09

what are the output for numbers such as "11, 12, 14, 18, 14014, 21" ?

Sanchit Manchanda: 2012-06-20 13:15:53

hi my id is 7183029
i tried alot of test cases i am getting the correct ans. can you tell me whats my mistake.. pls

Piotr KÄ…kol: 2012-06-13 09:58:44

Why not allow all languages? Is it really important to exclude such languages as Prolog, C99, C#, etc.?

Aditya Pande: 2012-05-27 10:32:50

i ve got ac in c
but not getting ac in python 2.5
it gives WA after running (15)plz tell which test case i am failing at submission id 7136376

EDIT:
got AC in RUBY

Last edit: 2012-07-26 10:20:36
varshinirai: 2012-05-06 06:42:38

alwys WA can anybdy tel me the reasn plsss.... My submss ID:6951645

ginnipkj: 2012-02-04 04:52:41

how many test cases?

Bharath Reddy: 2011-12-19 11:53:15

Can someone tell me what could have gone wrong with my code
I have run my code for all inputs(0 to 50000) and checked.
Still the judge says "runtime error-NZEC"
Edit: Got it! I was taking n inputs and producing n outputs...
But the problem statement gives only one input

Last edit: 2011-12-19 12:45:32
bashrc is back: 2011-06-29 11:56:31

whitespaces need to be removed?
Edit:No they need not.

Last edit: 2011-07-01 02:45:45
hbm: 2011-06-01 15:37:53

Can you give one example that is causing 5179686 to fail? I ran it for 1..50000 and everything looks good. Thanks.

Filip Wielewski: 2011-03-07 08:15:19

Because of a wrong judge assigned to one of the test cases, the problem has been rejudged.


Added by:Kawmia Institutes
Date:2011-02-12
Time limit:1s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ADA95 ASM32 ASM64 BASH BF CSHARP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO ICON ICK JS-RHINO LUA NEM NICE OCAML PIKE PRLG-swi SCALA SCM guile SCM qobi ST TCL WHITESPACE
Resource:XeRon!X problem in opposite way