Generate All Substrings Leetcode 150 Solution