#C4538. Digit to Letter Combinations
Digit to Letter Combinations
Digit to Letter Combinations
Given a string digits consisting only of digits from 2 to 9, generate all possible letter combinations that the number could represent using the standard telephone keypad mapping. The mapping is given by:
\(2:\ abc, \ 3:\ def, \ 4:\ ghi, \ 5:\ jkl, \ 6:\ mno, \ 7:\ pqrs, \ 8:\ tuv, \ 9:\ wxyz\)
You should produce all possible strings by replacing each digit with one of its corresponding letters. The output should be presented in lexicographical order. If the input string is empty, output nothing.
Constraints:
- The input string contains only digits in the range [2, 9].
- The length of the input string is between 1 and 4.
inputFormat
The input is a single line consisting of a string of digits (only characters '2' to '9').
For example: 23
outputFormat
Print all possible letter combinations, each on a separate line, in lexicographical order. If there are no combinations (i.e. the input is an empty string), output nothing.
## sample2
a
b
c
</p>