Hide

Problem E
Exciting English Enunciations

Elena is working on Sicorexa, the next great virtual assistant. Currently, Sicorexa is able to correctly pronounce English words, but not numbers. Since Elena wants Sicorexa to be an attractive option for scientists, Zimbabwean millionaires during hyperinflation, and other people who use large numbers, this needs to be rectified soon!

In English, numbers are pronounced by grouping the digits into sets of $3$, starting from the least significant digit. Each set of $3$ digits is pronounced separately, followed by a word indicating where that set is located within the number according to the table below. Note that if any set of $3$ digits is zero, it is not pronounced.

Position

Pronunciation

$10^3$

thousand

$10^6$

million

$10^9$

billion

$10^{12}$

trillion

$10^{15}$

quadrillion

$10^{18}$

quintillion

$10^{21}$

sextillion

$10^{24}$

septillion

$10^{27}$

octillion

$10^{30}$

nonillion

$10^{33}$

decillion

Given a list of numbers, help Elena transform them into their English pronunciations so that Sicorexa can say them aloud.

Input

The input begins with a single line containing an integer $q$, $1 \le q \le 50$. The next $q$ lines each contain a single integer $n$, $0 \le n < 10^{36}$. No integer contains leading zeros.

Output

For each of the $q$ integers in the input, output a single line containing the English pronunciation of that integer. The output must follow these guidelines:

  • All letters are in lower case.

  • Every word is separated by at least one space.

  • Does not contain hyphens or the word “and”.

Sample Input 1 Sample Output 1
5
11
248
1918074
13004000
15000000017
eleven
two hundred forty eight
one million nine hundred eighteen thousand seventy four
thirteen million four thousand
fifteen billion seventeen
CPU Time limit 2 seconds
Memory limit 1024 MB
Author
Kriangsiri Malasri
Source Consortium for Computing Sciences in Colleges Mid-South Programming Contest 2019
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in