| 1 | import java.util.*; |
| 2 | |
| 3 | public class Main { |
| 4 | static void combination(String dig, String[] kp, String res) { |
| 5 | if (dig.length() == 0) { |
| 6 | System.out.print(res + " "); |
| 7 | return; |
| 8 | } |
| 9 | int currNum = dig.charAt(0) - '0'; |
| 10 | String currChoices = kp[currNum]; |
| 11 | for (int j = 0; j < currChoices.length(); j++) { |
| 12 | combination(dig.substring(1), kp, res + currChoices.charAt(j)); |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | public static void main(String[] args) { |
| 17 | Scanner sc = new Scanner(System.in); |
| 18 | String s = sc.nextLine(); |
| 19 | String[] keypad = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqr", "stuv", "wxyz"}; |
| 20 | combination(s, keypad, ""); |
| 21 | } |
| 22 | } |
nothing calls this directly
no outgoing calls
no test coverage detected