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:2010-08-24
Time limit:1s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC SCM qobi VB.NET
Resource:-

hide comments
2011-01-07 10:03:34 Piotr KÄ…kol
Good to know, thanks! My mistake. <ashamed>

Last edit: 2011-01-07 10:04:34
2011-01-07 09:18:46 numerix
No, it's definitely "forty".
2011-01-05 15:25:55 Piotr KÄ…kol
Probably fourty, because "thirty four thousand one hundred eight".
2011-01-05 14:44:53 Hallvard Norheim Bø
How is 40 spelled in the testcases? Fourty or forty?
2010-08-28 14:12:14 XeRoN!X
now, perl6 is available for this problem
2010-08-24 19:06:59 XeRoN!X
there was a test case bug, its fixed now.


Last edit: 2010-08-24 19:09:46
2010-08-24 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.
2010-08-24 11:01:56 Piotr Fusik
Please tell me for what input my solution fails?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.