
    Write a function that analyzes a customer's payment history string (where '1' represents on-time payments and '0' represents late payments) to find the time period with the largest disparity between reliable and unreliable payment behavior. The function should return the maximum difference between the count of late payments and on-time payments within any continuous period of the customer's history to help assess their creditworthiness trend.
    

    
def find_length(string):
    """
    Write a function that analyzes a customer's payment history string (where '1' represents on-time payments and '0' represents late payments) to find the time period with the largest disparity between reliable and unreliable payment behavior. The function should return the maximum difference between the count of late payments and on-time payments within any continuous period of the customer's history to help assess their creditworthiness trend.
    

    """
def find_length(string):
    """
    Write a function that analyzes a customer's payment history string (where '1' represents on-time payments and '0' represents late payments) to find the time period with the largest disparity between reliable and unreliable payment behavior. The function should return the maximum difference between the count of late payments and on-time payments within any continuous period of the customer's history to help assess their creditworthiness trend.
    

    """
    n = len(string)
    current_sum = 0
    max_sum = 0
    for i in range(n):
        current_sum += 1 if string[i] == '0' else -1
        if current_sum < 0:
            current_sum = 0
        max_sum = max(current_sum, max_sum)
    return max_sum if max_sum else 0