
    Write a function that analyzes delivery route segments to identify viable sub-routes where the total number of delivery points equals the number of road sections covered. Given an encoded route string where each digit represents delivery points per section, determine how many possible sub-routes satisfy this balanced delivery-to-distance ratio requirement.
    

    
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that analyzes delivery route segments to identify viable sub-routes where the total number of delivery points equals the number of road sections covered. Given an encoded route string where each digit represents delivery points per section, determine how many possible sub-routes satisfy this balanced delivery-to-distance ratio requirement.
    

    """
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that analyzes delivery route segments to identify viable sub-routes where the total number of delivery points equals the number of road sections covered. Given an encoded route string where each digit represents delivery points per section, determine how many possible sub-routes satisfy this balanced delivery-to-distance ratio requirement.
    

    """
    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