
    Write a function that identifies potential fraudulent transactions by analyzing transaction identifiers for suspicious numerical patterns, where a pattern is considered suspicious if the sum of its digits equals its length in characters. Given a transaction identifier string containing only digits, determine how many of its substrings exhibit this suspicious pattern that could indicate potential fraud.
    

    
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that identifies potential fraudulent transactions by analyzing transaction identifiers for suspicious numerical patterns, where a pattern is considered suspicious if the sum of its digits equals its length in characters. Given a transaction identifier string containing only digits, determine how many of its substrings exhibit this suspicious pattern that could indicate potential fraud.
    

    """
from collections import defaultdict

def count_Substrings(s):
    """
    Write a function that identifies potential fraudulent transactions by analyzing transaction identifiers for suspicious numerical patterns, where a pattern is considered suspicious if the sum of its digits equals its length in characters. Given a transaction identifier string containing only digits, determine how many of its substrings exhibit this suspicious pattern that could indicate potential fraud.
    

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