#K5026. Longest Consecutive Ones in Binary Representation
Longest Consecutive Ones in Binary Representation
Longest Consecutive Ones in Binary Representation
Given an integer (N), your task is to determine the length of the longest consecutive sequence of (1)'s in its binary representation.
For example, if (N = 156), its binary representation is 10011100
, and the longest sequence of consecutive ones is 111
with a length of 3. Use this knowledge to solve the problem and output the correct result.
inputFormat
A single integer (N) provided via standard input (stdin).
outputFormat
Print the length of the longest consecutive sequence of (1)'s in the binary representation of (N) to standard output (stdout).## sample
156
3