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
2017-08-13 10:23:08 uts91
can it be done in O(n) using stack ?
2016-01-19 16:24:08
Can a problem statement get worse than this ? No clue on what the solution is for case like 1100, 11011, 111 .. The problem lies in cases which involve numbers from eleven to nineteen ..
Edit: AC after spending a lot of time in scanning my output for errors.. One case that is really tricky is numbers between 1000-1100.. Atleast for my method to solve this question..

Last edit: 2016-01-19 19:54:39
2014-08-17 19:22:47 Alexandre Henrique Afonso Campos
0<=n>=50,000 should be
0<=n<=50,000
2014-01-01 23:42:30 Mitch Schwartz
@Denys: "zero".
2014-01-01 23:25:01 Denys
what should we output for 0? "zero"? or "null"? or may be something else?...
2013-07-28 16:08:10 THE_SCORPION
Any help please ?
2013-04-05 14:59:32 Mostafa 36a2
for who gets wrong answer ...
be sure that you spell the numbers correctly
Specifically:
fourteen,fifteen,eighteen,nineteen
forty,fifty,ninety
hope you get AC :)

Last edit: 2013-04-05 16:10:57
2013-02-26 11:28:50 rohit ajmera
i am getting nzec in 19th case.
my id 8786344.
what to do
2013-01-24 16:25:24 Ankur Rastogi
always WA can anybody tell me the reason please.... My submission ID:8566921
2012-09-01 03:48:54 PANKAJ SAINI
0<=n>=50,000
what does it mean???

n>=0 ??
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.