
    Write a function that analyzes a student's learning progress string, where each digit represents a module completion score, to identify balanced learning sequences. A balanced sequence occurs when the sum of achievement scores in a continuous segment equals the length of that segment, and your function should return the total count of such balanced sequences in the student's learning journey.
    

    
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that analyzes a student's learning progress string, where each digit represents a module completion score, to identify balanced learning sequences. A balanced sequence occurs when the sum of achievement scores in a continuous segment equals the length of that segment, and your function should return the total count of such balanced sequences in the student's learning journey.
    

    """
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that analyzes a student's learning progress string, where each digit represents a module completion score, to identify balanced learning sequences. A balanced sequence occurs when the sum of achievement scores in a continuous segment equals the length of that segment, and your function should return the total count of such balanced sequences in the student's learning journey.
    

    """
    n = len(s)
    (count, sum) = (0, 0)
    mp = defaultdict(lambda : 0)
    mp[0] += 1
    for i in range(n):
        sum += ord(s[i]) - ord('0')
        count += mp[sum - (i + 1)]
        mp[sum - (i + 1)] += 1
    return count