Help me in solving DSSA19 problem

My issue

My code

def max_people_in_towers(N, S):
    max_people = 0
    
    for i in range(N):
        if S[i] == '0' and (i == -1 or S[i - 1] == '0'):
            max_people += 1
            S[i] = ''
            
    return max_people
    
if __name__ == "__main__":
    T = int(input()) 
    
    for _ in range(T):
        N = int(input())
        S = list(input().strip())
        
        result = max_people_in_towers(N, S)
        print(result)

Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone