NUMWORD - Number to Word

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.


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

hide comments
2012-07-16 22:04:09 david_8k
what are the output for numbers such as "11, 12, 14, 18, 14014, 21" ?
2012-06-20 13:15:53 Sanchit Manchanda
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
2012-06-13 09:58:44 Piotr KÄ…kol
Why not allow all languages? Is it really important to exclude such languages as Prolog, C99, C#, etc.?
2012-05-27 10:32:50 Aditya Pande
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
2012-05-06 06:42:38 varshinirai
alwys WA can anybdy tel me the reasn plsss.... My submss ID:6951645
2012-02-04 04:52:41 ginnipkj
how many test cases?
2011-12-19 11:53:15 Bharath Reddy
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
2011-06-29 11:56:31 bashrc is back
whitespaces need to be removed?
Edit:No they need not.

Last edit: 2011-07-01 02:45:45
2011-06-01 15:37:53 hbm
Can you give one example that is causing 5179686 to fail? I ran it for 1..50000 and everything looks good. Thanks.
2011-03-07 08:15:19 Filip Wielewski
Because of a wrong judge assigned to one of the test cases, the problem has been rejudged.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.