Count Distinct Substrings Leetcode Contest Ladder Stitch