
    Given a sequence of bus stops where each stop is marked as either high-demand ('1') or low-demand ('0'), find the route segment that has the maximum imbalance between high and low-demand stops. The imbalance is calculated as the absolute difference between the number of high-demand stops and low-demand stops within any continuous segment of the route.
    

    
def find_length(string):
    """
    Given a sequence of bus stops where each stop is marked as either high-demand ('1') or low-demand ('0'), find the route segment that has the maximum imbalance between high and low-demand stops. The imbalance is calculated as the absolute difference between the number of high-demand stops and low-demand stops within any continuous segment of the route.
    

    """
def find_length(string):
    """
    Given a sequence of bus stops where each stop is marked as either high-demand ('1') or low-demand ('0'), find the route segment that has the maximum imbalance between high and low-demand stops. The imbalance is calculated as the absolute difference between the number of high-demand stops and low-demand stops within any continuous segment of the route.
    

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