@@ -0,0 +1,936 @@
+class Solution:%0A    # @param %7Bstring%7D digits%0A    # @return %7Bstring%5B%5D%7D%0A    def letterCombinations(self, digits):%0A        if not digits:%0A            return %5B%5D%0A        mapping = %7B%0A            '2': %22abc%22,%0A            '3': %22def%22,%0A            '4': %22ghi%22,%0A            '5': %22jkl%22,%0A            '6': %22mno%22,%0A            '7': %22pqrs%22,%0A            '8': %22tuv%22,%0A            '9': %22wxyz%22%0A            %7D%0A        results = %5B%5D%0A        for d in digits:%0A            if d not in mapping:%0A                return None%0A            if results:%0A                newResults = %5B%5D%0A                while results:%0A                    result = results.pop(0)%0A                    for ch in mapping%5Bd%5D:%0A                        newResults.append(result+ch)%0A                results = newResults%0A            else:%0A                results = %5Bch for ch in mapping%5Bd%5D%5D%0A        return results%0A%0Aif __name__ == %22__main__%22:%0A    sol = Solution()%0A    print sol.letterCombinations(%2222%22)%0A%0A

solve 17