it works well for all kind of integer lists. What's wrong ?
package pl.codegym.task.task08.task0812;
import java.io.*;
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.Collections;
public class Solution {
public static void main(String[] args) throws IOException {
//tutaj wpisz swój kod
ArrayList<Integer> lista = new ArrayList<Integer>();
ArrayList<Integer> listaSEQ = new ArrayList<Integer>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
for (int i= 0;i<10;i++) {
String str = reader.readLine();
lista.add(Integer.parseInt(str));} //dodawanie elementów
int seq = 1;
try {
for (int i=0;i<10;i++) {
listaSEQ.add(seq);
if (lista.get(i) == lista.get(i+1)){
seq++;}
if (lista.get(i) != lista.get(i+1)){
seq=1;}
}
}
catch (IndexOutOfBoundsException e){}
int max = Collections.max(listaSEQ);
System.out.println(max);
}
}