Generate All Substring Leetcode Python Coding