#P3864. Cow Name Translator
Cow Name Translator
Cow Name Translator
At Wisconsin's large dairy farms, accountants stamp cows with consecutive numbers. However, the cows have no appreciation for this system since they prefer to be called by names rather than by their stamping numbers. To help the poor herder, write a program that translates a cow's stamped number into a possible name.
Using the standard phone keypad mapping (excluding the letters Q and Z), the transformation is as follows:
\(2: A, B, C\)
\(3: D, E, F\)
\(4: G, H, I\)
\(5: J, K, L\)
\(6: M, N, O\)
\(7: P, R, S\)
\(8: T, U, V\)
\(9: W, X, Y\)
Only those names present in the dictionary file dict.txt
(which contains 4617 valid names in alphabetical order, all in uppercase) are acceptable. If no valid name exists for the given number, output NONE
.
Note that the input number may have up to 12 digits.
inputFormat
The input consists of a single line containing the cow's stamped number.
outputFormat
Output all valid cow names (one per line) that correspond to the given number based on the mapping. If no valid name exists, output NONE
.
sample
4734
GREG
</p>