import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); scanner.useDelimiter("\n"); while (scanner.hasNextInt()) { int num = scanner.nextInt(); int max = 0; int result = 0; while (num > 0) { int yu = num % 2; if (yu == 1) { max++; } else { result = Math.max(result, max); max = 0; } num /= 2; } System.out.println(Math.max(max, result)); } } }