#P16469. [GKS 2013 #A] Read Phone Number

    ID: 16454 Type: RemoteJudge 1000ms 1024MiB Tried: 0 Accepted: 0 Difficulty: 3 Uploaded By: Tags>模拟2013Google Kick Start

[GKS 2013 #A] Read Phone Number

题目描述

Do you know how to read the phone numbers in English? Now let me tell you.

For example, In China, the phone numbers are 1111 digits, like: 1501223344415012233444. Someone divides the numbers into 33-44-44 format, i.e. 150 1223 3444150 \ 1223 \ 3444. While someone divides the numbers into 33-33-55 format, i.e. 150 122 33444150 \ 122 \ 33444. Different formats lead to different ways to read these numbers:

150 1223 3444150 \ 1223 \ 3444 reads one five zero one double two three three triple four.

150 122 33444150 \ 122 \ 33444 reads one five zero one double two double three triple four.

Here comes the problem:

Given a list of phone numbers and the dividing formats, output the right ways to read these numbers.

Rules:

Single numbers just read them separately.

22 successive numbers use double.

33 successive numbers use triple.

44 successive numbers use quadruple.

55 successive numbers use quintuple.

66 successive numbers use sextuple.

77 successive numbers use septuple.

88 successive numbers use octuple.

99 successive numbers use nonuple.

1010 successive numbers use decuple.

More than 1010 successive numbers read them all separately.

输入格式

The first line of the input gives the number of test cases, TT. TT lines|test cases follow. Each line contains a phone number NN and the dividing format FF, one or more positive integers separated by dashes (-), without leading zeros and whose sum always equals the number of digits in the phone number.

输出格式

For each test case, output one line containing "Case #x: y", where x is the case number (starting from 1) and y is the reading sentence in English whose words are separated by a space.

3
15012233444 3-4-4
15012233444 3-3-5
12223 2-3
Case #1: one five zero one double two three three triple four
Case #2: one five zero one double two double three triple four
Case #3: one two double two three

提示

Limits

1T1001 \le T \le 100.

Test set 1 - Visible

1length of N101 \le \text{length of } N \le 10.

Test set 2 - Hidden

1length of N1001 \le \text{length of } N \le 100.