解题思路2:用0分割字符串,求分割后字符串的最大长度。 Pythonic

while True:
    try:
        a = int(input())
        b = str(bin(a)[2:])
        c = b.split('0')
        l = []
        for i in c:
            l.append(len(i))
        print(max(l))
    except:
        break