Count Unique Substring Leetcode Javascript 30