P1245 Phone Number
Description
On a telephone keypad, several English letters are written under each digit. The mapping is as follows:
- $1\leftrightarrow \verb!a!,\verb!b!,\verb!c!$.
- $2\leftrightarrow \verb!d!,\verb!e!,\verb!f!$.
- $3\leftrightarrow \verb!g!,\verb!h!,\verb!i!$.
- $4\leftrightarrow \verb!j!,\verb!k!,\verb!l!$.
- $5\leftrightarrow \verb!m!,\verb!n!$.
- $6\leftrightarrow \verb!o!,\verb!p!,\verb!q!$.
- $7\leftrightarrow \verb!r!,\verb!s!,\verb!t!$.
- $8\leftrightarrow \verb!u!,\verb!v!,\verb!w!$.
- $9\leftrightarrow \verb!x!,\verb!y!,\verb!z!$.
Now, given a word list and a sequence of digits (a numeric code), please translate the code using words from the list.
Input Format
The first line contains a positive integer $N$ indicating the number of words in the list $(N \le 100)$.
The second line contains a digit string of length at most $100$, representing the code.
The next $N$ lines each contain one word of length at most $20$, representing the word list.
Output Format
Output a single line: the decoded original text. If the code cannot be translated, output `No Solutions!`. If there are multiple valid translations, output any one of them.
Explanation/Hint
SPJ provided by @zhouyonglong.
Translated by ChatGPT 5