Python3 解题思路

    try:
        s = input()
        ## 数字格式-> 二元格式 -> 清除非数字 -> 零作为间隔符号
        string = bin(int(s)).replace("0b", "").split("0")
        longest = 0
        for i in string:
            count = i.count("1")
            if count > longest:
                longest = count
        print(longest)
    except: break