public class Solution { public static void main(String[] args) throws IOException { //напишите тут ваш код BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); List <Integer> list = new ArrayList(); for(int i=0; i<10; i++) { list.add(Integer.parseInt(reader.readLine())); } int max = 0; int count = 0; for(int i=0; i<9; i++) { if(list.get(i).equals(list.get(i+1))) count ++; else count = 1; if(max<count) max = count; } System.out.println(max); } } Проверял (работает) на: по умолчанию 1117777777 12345678910 с числами > 127