Задание:
1. Создай список чисел.
2. Добавь в список 10 чисел с клавиатуры.
3. Вывести на экран длину самой длинной последовательности повторяющихся чисел в списке.
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
list.add(Integer.parseInt(reader.readLine()));
}
int maxMatchesQuantity = 0;
for (int i = 0; i < list.size(); i++) {
int matchesOnIteration = 0;
for (Object o : list) {
if (list.get(i).equals(o)) matchesOnIteration++;
}
if (matchesOnIteration > maxMatchesQuantity) maxMatchesQuantity = matchesOnIteration;
}
System.out.println(maxMatchesQuantity);