• + 0 comments

    Python

        n = int(input().strip())
        temp = 0
        res = 0
        while n != 0:
            if n % 2 == 1:
                temp += 1
            elif n % 2 == 0:
                temp = 0
            res = max(temp, res)
            n = (int)(n / 2)
        print(res)