很久以前,在一个遥远的、只居住着数学系学生的国度里,Iva 和 Vedran 正在讨论“自解释句子”。这些句子中的一部分恰好是一个数字,且该数字等于句子中所有字母的总数。例如:“This sentence has thirtyone letters.”(本句子有三十一个字母。),“Blah blah seventeen”(废话废话十七)。
小 Jurica 偷听到了他朋友们的谈话,并决定用他熟记于心的自解释句子的数量来给他们留下深刻印象。他冲回家写了一个程序,该程序在给定一个句子的情况下,能够告诉他可以填入其中的最小数字,使得该句子是合法的。不幸的是,他的电脑坏了,现在他需要你的帮助。写一个程序来帮助 Jurica 吧!
句子的格式为:word1 word2 word3 ... $ word_n-1 word_n。字符 $ 表示应该填入数字的位置。
例如,句子 “this sentence has thirtyone letters” 的格式将是 “this sentence has $ letters”。
书写数字的规则如下:
- $1$ 到 $10$ 的数字分别写为 “one”, “two”, “three”, “four”, “five”, “six”, “seven”, “eight”, “nine”, “ten”;
- $11$ 到 $19$ 的数字分别写为 “eleven”, “twelve”, “thirteen”, “fourteen”, “fifteen”, “sixteen”, “seventeen”, “eighteen”, “nineteen”;
- 其余的两位数书写时,先写出十位数字的名称,然后加上去掉十位后剩余的一位数名称。特别地,如果去掉十位后剩余的是零,则不加任何内容;
- 十位数字(分别对应 $2$ 到 $9$)的名称如下:“twenty”, “thirty”, “forty”, “fifty”, “sixty”, “seventy”, “eighty”, “ninety”;
- 三位数书写时,先写出百位数字的名称,然后加上去掉百位后剩余的两位数名称。特别地,如果去掉百位后剩余的是零,则不加任何内容;
- 百位数字(分别对应 $1$ 到 $9$)的名称如下:“onehundred”, “twohundred”, “threehundred”, “fourhundred”, “fivehundred”, “sixhundred”, “sevenhundred”, “eighthundred”, “ninehundred”;
- 适用于三位以上数字的规则与本题无关,因为输入数据将始终保证输出小于一千。
一些数字命名的例子:
- $68$ = “sixty” + “eight” = “sixtyeight”
- $319$ = “threehundred” + “nineteen” = “threehundrednineteen”
- $530$ = “fivehundred” + “thirty” = “fivehundredthirty”
- $971$ = “ninehundred” + “seventy” + “one” = “ninehundredseventyone”
输入格式
输入的第一行包含整数 $N$ ($1 \le N \le 20$),表示句子中的单词数。
接下来的 $N$ 行,每行包含一个长度不超过 $50$ 的英文小写字母单词,或者字符 $(单词中不会有任何单词是数字的英文名称)。
字符 $ 恰好出现一次。
输出格式
输出的第一行也是唯一一行必须包含所求的句子。
数字的命名如前所述,即使句子听起来在语法上不正确。
输入数据保证一定存在解,且解小于 $1000$。
子任务
在占总分 $40\%$ 的测试数据中,句子所需的数字将小于或等于 $50$。
样例
输入 1
5 this sentence has $ letters
输出 1
this sentence has thirtyone letters
输入 2
7 $ is the number of letters here
输出 2
thirty is the number of letters here
输入 3
5 the letters are $ potato
输出 3
the letters are twentynine potato
说明
第二个样例的说明:在样例表格中,句子由于空间不足而被拆分为两行。句子中的总字母数为 $6 + 2 + 3 + 6 + 2 + 7 + 4 = 30$。
第三个样例的说明:如你所见,这个句子在语法上是不正确的。然而,Jurica 并不关心这一点,因为他是一个数学家,而不是语言学家。