Letter Combinations of a Phone Number

MediumRecursion & Backtracking
Next
BacktrackingString

On a phone keypad each digit maps to letters: 2=abc, 3=def, 4=ghi, 5=jkl, 6=mno, 7=pqrs, 8=tuv, 9=wxyz. Given a string of digits from 2 to 9, print every letter combination it could represent, one per line, in lexicographic order.

Input

A single line of digits from 2 to 9.

Output

One combination per line, in lexicographic order.

Constraints

1 <= length <= 6

Example 1
Input
23
Output
ad
ae
af
bd
be
bf
cd
ce
cf

ad ae af bd be bf cd ce cf, each on its own line.

Hints

Letter Combinations of a Phone Number - Medium Recursion & Backtracking Problem | Skill Shiksha