Find All Possible Interpretations

Consider a coding system for alphabets to integers where ‘a’, ‘b’, ..., ‘z’ are represented as 1, 2, ..., 26. Given a string of digits 1..9 as input, write a function that prints all valid interpretations of input array. Return all the interpretations as a string array in lexicographic order.


"11" should return ["aa", "k"] since (1, 1) is "aa" and (11) is "k"

"121" should return ["aba", "au", "la"] since (1, 2, 1) is "aba", (1, 21) is "au" and (12, 1) is "la".

Contributed by Berkan Teber