题面
On a standard telephone keypad, the digits are mapped onto the alphabet (minus the letters Q and Z) as shown in this diagram:
In order to make their phone numbers more memorable, service providers like to find numbers that spell out some word appropriate to their business that makes that phone number easier to remember. Such words that help you remember some other data are called mnemonics.
Write a function ListMnemonics that generates all possible letter combinations that correspond to a given number, represented as a string of digits. For example, if you call ListMnemonics (“723”) your program should generate the 27 possible letter combinations corresponding to that prefix, as follows:
If the argument passed to ListMnemonics contains a 0 or a 1, that position in the output should simple be displayed as the digit, since there are no letters that correspond to it. For example, if you used the function to generate mnemonics for the area code 415, you program should generate the following nine strings:
输入格式
A string with three digits
输出格式
All mnemonics with alphabetical order, one mnemonic in one line
样例
输入
723
输出
PAD PAE PAF PBD PBE PBF PCD PCE PCF RAD RAE RAF RBD RBE RBF RCD RCE RCF SAD SAE SAF SBD SBE SBF SCD SCE SCF
输入
415
输出
G1J G1K G1L H1J H1K H1L I1J I1K I1L
输入
000
输出
000