Count Distinct Substring Leetcode