
    Given a student's daily attendance record for a semester represented as a sequence where '1' marks presence and '0' marks absence, find the time period (continuous sequence of days) that shows the most concerning attendance pattern by calculating the maximum difference between the number of absences and presences. This analysis helps identify periods of significant disengagement that may indicate dropout risk.
    

    
def find_length(string):
    """
    Given a student's daily attendance record for a semester represented as a sequence where '1' marks presence and '0' marks absence, find the time period (continuous sequence of days) that shows the most concerning attendance pattern by calculating the maximum difference between the number of absences and presences. This analysis helps identify periods of significant disengagement that may indicate dropout risk.
    

    """
def find_length(string):
    """
    Given a student's daily attendance record for a semester represented as a sequence where '1' marks presence and '0' marks absence, find the time period (continuous sequence of days) that shows the most concerning attendance pattern by calculating the maximum difference between the number of absences and presences. This analysis helps identify periods of significant disengagement that may indicate dropout risk.
    

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