1180. Inglish-Number Translator

单点时限: 2.0 sec

内存限制: 256 MB

In this problem, you will be given one or more integers in English. Your task is to translate these numbers into their integer representation. The numbers can range from negative 999,999,999 to positive 999,999,999. The following is an exhaustive list of English words that your program must account for:

negative, zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million

输入格式

The input consists of several instances. Notes on input:

  1. Negative numbers will be preceded by the word negative.

  2. The word “hundred” is not used when “thousand” could be. For example, 1500 is written “one thousand five hundred”, not “fifteen hundred”.

The input is terminated by an empty line.

输出格式

The answers are expected to be on separate lines with a newline after each.

样例

Input
six
negative seven hundred twenty nine
one million one hundred one
eight hundred fourteen thousand twenty two
Output
6
-729
1000101
814022

17 人解决,24 人已尝试。

19 份提交通过,共有 57 份提交。

5.1 EMB 奖励。

创建: 17 年,6 月前.

修改: 7 年,2 月前.

最后提交: 1 年,4 月前.

来源: CTU Open 2004

题目标签