Count Distinct Substrings Leetcode Sql Queries