Count Distinct Substrings Leetcode Sql Server