
    Given a string of route segment identifiers where each digit represents the number of delivery stops in that segment, write a function that finds the number of continuous route subsegments where the total number of stops equals the length of that subsegment. These subsegments will help identify optimal delivery zones for fleet distribution.
    

    
from collections import defaultdict

def count_Substrings(s):
    """
    Given a string of route segment identifiers where each digit represents the number of delivery stops in that segment, write a function that finds the number of continuous route subsegments where the total number of stops equals the length of that subsegment. These subsegments will help identify optimal delivery zones for fleet distribution.
    

    """
from collections import defaultdict

def count_Substrings(s):
    """
    Given a string of route segment identifiers where each digit represents the number of delivery stops in that segment, write a function that finds the number of continuous route subsegments where the total number of stops equals the length of that subsegment. These subsegments will help identify optimal delivery zones for fleet distribution.
    

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