Problem 2:
Maximum Run of Ones or Zeros
Given an integer input from the keyboard, determine the maximum number of
consecutive 1's or 0's in the 32-bit two's complement representation of the
integer. For example, The integer 12 has the representation
12 = 0000 0000 0000 0000 0000 0000 0000 1100
This integer has 28 0's in a row, so your program should print out 28.
The number -2 has the representation:
-2 = 1111 1111 1111 1111 1111 1111 1111 1110
which has 31 1's in a row, so your program should print out 31.
To hand in the program, use the command:
handin acmjudge prog2