• + 0 comments

    Pyhton

    n = int(input())

    binary_representation = bin(n)[2:]

    consecutive_ones = binary_representation.split('0')

    max_consecutive_ones = max(len(group) for group in consecutive_ones)

    print(max_consecutive_ones)