Nokia Messaging

easyRecursion

You are given a string $$$s$$$ of length $$$n$$$ consisting of digits from '$$$2$$$' to '$$$9$$$' inclusive. These digits map to letters on an old Nokia phone keypad as follows:

  • 2 maps to either $$$a$$$ or $$$b$$$ or $$$c$$$
  • 3 maps to either $$$d$$$ or $$$e$$$ or $$$f$$$
  • 4 maps to either $$$g$$$ or $$$h$$$ or $$$i$$$
  • 5 maps to either $$$j$$$ or $$$k$$$ or $$$l$$$
  • 6 maps to either $$$m$$$ or $$$n$$$ or $$$o$$$
  • 7 maps to either $$$p$$$ or $$$q$$$ or $$$r$$$ or $$$s$$$
  • 8 maps to either $$$t$$$ or $$$u$$$ or $$$v$$$
  • 9 maps to either $$$w$$$ or $$$x$$$ or $$$y$$$ or $$$z$$$

Your task is to compute all possible letter combinations that the number could represent. Output these combinations sorted in lexicographical order.

Input Format:

The first line of input contains integer $$$n(0 \le n \le 4)$$$ — the number of characters in input string $$$s$$$.

The second line of input contains string $$$s$$$ of length $$$n$$$.

Output Format:

Output every possible letter combination that the number could mean in separate lines, sorted in lexicographical order.

If no possible output exists, output the string "NO".

Examples:

Example 1:

Input:

2
23

Output:

ad
ae
af
bd
be
bf
cd
ce
cf

Example 2:

Input:

1
2

Output:

a
b
c

Code

Loading Editor...