В IDEA компилируется, тут не проходит по 4-му пункту. Почему ?
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int count = 0;
List<Integer> list = new ArrayList<>();
List<Integer> list1 = new ArrayList<>();
for (int i = 0; i < 10; i++)
list.add(Integer.parseInt(reader.readLine()));
list.add(0);
for (int i = 0; i < 10; i++)
if (list.get(i).equals(list.get(i + 1)))
count++;
else {
list1.add(count);
count = 0;
}
System.out.println(Collections.max(list1) + 1);
}
}
package com.javarush.task.task08.task0812;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
/*
Cамая длинная последовательность
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int count = 0;
List<Integer> list = new ArrayList<>();
List<Integer> list1 = new ArrayList<>();
for (int i = 0; i < 10; i++)
list.add(Integer.parseInt(reader.readLine()));
list.add(0);
for (int i = 0; i < 10; i++)
if (list.get(i).equals(list.get(i + 1)))
count++;
else {
list1.add(count);
count = 0;
}
System.out.println(Collections.max(list1) + 1);
}
}