Number Format Translator

Numbers can be represented with arabic digits or with cardinal numerals. In payment checks, the user is supposed to write the same number twice, in both formats: In one place in the arabic digits format (e.g. 203) and in another place in the cardinal numerals format (e.g. duzentos e trˆes). Assume that a new generation of Optical Character Recognition (OCR) devices functions with a negligible margin of error. Accordingly, your customer, a Portuguese Bank which handles hundreds of thousands of payment checks per day, wants to develop an application to verify for each check, whether the number written in the numeral cardinals format matches the number written in the arabic digits format, so that only unmatching cases have to be handled manually. To translate a given number from its cardinal numerals representation into its arabic digits repre- sentation. Input The program input consists of a text file. The number (in arabic digits representation) in the first line indicates the number of remaining lines. Each of the remaining lines of text contains a number in cardinal numerals format, correctly represented according to the Portuguese orthography and grammar. For your convenience, here is a list of admissible punctuation marks and words integrating cardinal numerals (a set restricted for the sake of simplicity of the current programming problem): •, •e • zero, um, dois, tres, quatro, cinco, seis, sete, oito, nove • dez, onze, doze, treze, catorze, quatorze, quinze, dezasseis, dezesseis, dezassete, dezessete, dezoito, dezanove, dezenove • vinte, trinta, quarenta, cinquenta, sessenta, setenta, oitenta, noventa • cem, cento, duzentos, trezentos, quatrocentos, quinhentos, seiscentos, setecentos, oitocentos, novecentos • mil, milhao, milhoes, biliao, bilioes, bilhao, bilhoes Output The program output is a text file with as many lines as the input file. Its first line is identical to the first line of the input file. Each subsequent i-th line contains, in arabic digits format, the number represented in numeral cardinals in the ith line of the input file. Sample Input 12 quatro vinte e tres cento e vinte e sete mil

2/2 doze mil duzentos e cinco quatrocentos mil e cinco quatrocentos e trinta e sete mil e cem um milhao, cem mil quinhentos e seis trezentos e trinta e dois bilioes, quinze mil cento e oito mil milhoes duzentos bilioes, setenta e oito milhoes, sete mil e cem quinhentos bilioes e tres mil Sample Output 12 4 23 127 1000 12205 400005 437100 1100506 332000015108 1000000000 200078007100 500000003000