
    Given a customer's payment history string where '1' represents on-time payments and '0' represents late payments, find the time period (continuous sequence of payments) that shows the largest disparity between the number of late payments and on-time payments. This analysis helps identify the most significant period of payment instability in the customer's history to better assess their creditworthiness.
    

    
def find_length(string):
    """
    Given a customer's payment history string where '1' represents on-time payments and '0' represents late payments, find the time period (continuous sequence of payments) that shows the largest disparity between the number of late payments and on-time payments. This analysis helps identify the most significant period of payment instability in the customer's history to better assess their creditworthiness.
    

    """
def find_length(string):
    """
    Given a customer's payment history string where '1' represents on-time payments and '0' represents late payments, find the time period (continuous sequence of payments) that shows the largest disparity between the number of late payments and on-time payments. This analysis helps identify the most significant period of payment instability in the customer's history to better assess their creditworthiness.
    

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