
    Write a function to identify the number of patient monitoring periods where the cumulative symptom severity score (sum of daily ratings) equals the duration of the monitoring period in days. Each monitoring period is a continuous sequence from the patient's daily symptom severity log, where each digit represents a daily severity rating.
    

    
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function to identify the number of patient monitoring periods where the cumulative symptom severity score (sum of daily ratings) equals the duration of the monitoring period in days. Each monitoring period is a continuous sequence from the patient's daily symptom severity log, where each digit represents a daily severity rating.
    

    """
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function to identify the number of patient monitoring periods where the cumulative symptom severity score (sum of daily ratings) equals the duration of the monitoring period in days. Each monitoring period is a continuous sequence from the patient's daily symptom severity log, where each digit represents a daily severity rating.
    

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