Given a string containing digits from 2 to 9 (inclusive), return all the possible letter combinations that the number could denote. The resultant list should be sorted lexicographically.
The digits map to different letters as shown in the below image:
String: 234
Combinations: [
"adg", "adh", "adi",
"aeg", "aeh", "aei",
"afg", "afh", "afi",
"bdg", "bdh", "bdi",
"beg", "beh", "bei",
"bfg", "bfh", "bfi",
"cdg", "cdh", "cdi",
"ceg", "ceh", "cei",
"cfg", "cfh", "cfi"
]
The first line contains an integer ‘T’, denoting the number of test cases.
For each test case, the input has a string denoting the phone number.
For each test case, the output has the following lines:
3
2
23
234
3
a b c
9
ad ae af bd be bf cd ce cf
27
adg adh adi aeg aeh aei afg afh afi bdg bdh bdi beg beh bei bfg bfh bfi cdg cdh cdi ceg ceh cei cfg cfh cfi
1 <= T <= 10
'2' <= digit <= '9'
1 <= length <= 4