#include <stdio.h>
int main()
{
int n,r,c=0,t=0;
scanf("%d",&n);
while(n>0)
{
r=n%2;
if(r==1)
{
c++;
if(c>t)
t=c;
}
else
c=0;
n=n/2;
}
printf("%d",t);
return 0;
}
Hats off to simplification!
ReplyDeleteThanks a lot.