Help me in solving CS2023_STK problem

My issue

My code

import re
t = int(input())
for i in range(t):
    N = int(input())
    y = input()
    z = input()
    a = 0
    b = 0
    # for y in y:
    #     if (y != 0):
    #         a += 1
    #     else:
    #         break
    a = [x for x in y.split('0')]
    b = [w for w in z.split('0')]
    c = max(a).replace(" ","")
    d = max(b).replace(" ","")

    print(a)
    
    print(c)
    print(len(c))
    
    print(b)
    print(d)
    print(len(d))
    
    count_s = len(c)
    count_t = len(d)
    if (count_s > count_t): 
        print("Om")
    elif (count_t == count_s):
        print("Draw")
    else:
        print("Addy")
    

Problem Link: CS2023_STK Problem - CodeChef

@arnavsharma97

Taking input of streak as a string might be causing issues. The logic I used here was like this;

Took two counters, c and m, as current streak value and maximum streak value respectively.

Then, iterate over the whole loop. If a zero was found, compare c and m and change c to zero, otherwise c was increased by +1. Finally, m was returned.

Then by doing that for both and comparing the results, output was accordingly printed.

# cook your dish here
def cnt(l):
    c=0
    m=0
    for i in l:
        if(i==0):
            if(c>m):
                m=c
            c=0
        else:
            c+=1
    if(c>m):
        m=c
    return m
    
for _ in range(int(input())):
    n=int(input())
    om=list(map(int,input().split()))
    ad=list(map(int,input().split()))
    a=cnt(om)
    b=cnt(ad)
    if(a>b):
        print('Om')
    elif(b==a):
        print('Draw')
    else:
        print('Addy')