Count Number Of Substrings Leetcode Python Beginner