int i = 0, max = 1, c = 1;
while (i < 10) {
list.add(Integer.parseInt(reader.readLine()));
if (i != 0)
if (list.get(i).equals(list.get(i - 1))) {
c++;
i++;
continue;
}
if (c > max)
max = c;
c = 1;
i++;
}
System.out.println(max);
Make sure the program works correctly if the sequence consists of numbers greater than 127.
This website uses cookies to provide you with personalized service. By using this website, you agree to our use of cookies. If you require more details, please read our Terms and Policy.
GO TO FULL VERSION