Submit  All submissions  Best solutions  Back to list 
WORDNUM  Word To Number 
In this task you just need to convert a number from its word form to digit form. For example, you should output 1 for 'one', 37000 for 'thirty seven thousand' or 99 for 'ninety nine'. You can assume that output will be >= 0 and < 50000. Also all numbers will be valid i.e output will not have numbers like 023.
Input
First line of input has a single positive integer t = number of test cases. In the next t lines, given a number in word form.
Output
Output the number as specified.
Example
Input:
3
one hundred twenty three
thirty four thousand one hundred eight
eleven
Output:
123
34108
11
Score : Source code length
Added by:  XeRoN!X 
Date:  20100824 
Time limit:  0.175s 
Source limit:  1000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS OBJC SCM qobi VB.NET 
Resource:   
hide comments
20110107 10:03:34 Piotr KÄ…kol
Good to know, thanks! My mistake. <ashamed> Last edit: 20110107 10:04:34 

20110107 09:18:46 numerix
No, it's definitely "forty". 

20110105 15:25:55 Piotr KÄ…kol
Probably fourty, because "thirty four thousand one hundred eight". 

20110105 14:44:53 Hallvard Norheim Bø
How is 40 spelled in the testcases? Fourty or forty? 

20100828 14:12:14 XeRoN!X
now, perl6 is available for this problem 

20100824 19:06:59 XeRoN!X
there was a test case bug, its fixed now. Last edit: 20100824 19:09:46 

20100824 14:44:21 Piotr KÄ…kol
Unfortunately, I can't. I can only check user's output if it's task of mine. This isn't so You have to write Your request here or ask the author via email from his account. 

20100824 11:01:56 Piotr Fusik
Please tell me for what input my solution fails? 