Թաքցված խնդիր
|Այս խնդիրը թաքցված է խմբագրական խրհրդի անդամի կողմից քանի որ կամ այն ոչ ճիշտ լեզվով է գրված,|կամ թեստային տվյալներն են սխալ, կամ խնդրի ձևակերպումը պարզ չէ։|

ACM_0109 - THE QUEENS ENGLISH

   In the official British written word format for numbers, tens and units are separated by a hyphen, and hundreds are separated from tens or units by the word "and". For example the number 123 would be written "one hundred and twenty-three". Large numbers are written in "triads" (groups of three digits) followed by the appropriate suffixes. For example 123456 is "one hundred and twenty-three thousand four hundred and fifty-six". As a special case, if the final triad of a large number has a tens or units component but no hundreds component, it needs an "and". Thus 1001001 is "one million one thousand and one".

   Your task is to write a program that produces correct British written format for numbers of up to 9 digits (less than one "short" billion). Note that the correct spellings are "fifteen" and "fifty" ('f' instead of 'v'), and "forty" (no 'u').

Input

   Input will consist of specifications for a series of tests. Information for each test is a single line containing an integer 1 <= n < 1000000000 that specifies the value to process. A line containing the value 0 terminates the input.

Output

   Output should consist of one line for each test comprising the test number (formatted as shown) followed by a single space and the correct British word form of the input value, with a single space between words.

Examples

stdin

stdout

1

123
1001001
900090009
0

 

Test 1: one hundred and twenty-three
Test 2: one million one thousand and one
Test 3: nine hundred million ninety thousand and nine

Ավելացրեց.Հրանտ Հովհաննիսյան
Ամսաթիվ.2014-01-29
Ժամանակի սահմանափակումը.1s
Ծրագրի տեքստի սահմանափակումը.50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Լեզուներ.Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE
Աղբյուրը.Australian Programming Contest 2013.D

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.