Pomimo, że kod działa to nie jestem zadowolony, proszę o wskazówki jak można to zrobić lepiej, ewentualnie o wyslanie swoich rozwiązań. Dzięki wielkie za odpowiedzi
public class Solution {
public static void main(String[] args) throws IOException {
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 max = 1;
int count = 1;
int result = 1;
for (int i = 1; i < list.size(); i++) {
if (list.get(i).equals(list.get(i - 1))) {
count = max++;
} else if (!list.get(i).equals(list.get(i - 1))) {
if (max > count) {
count = max;
max = 1;
}
}
if (max > result) {
result = max;
}
}
System.out.println(result);
}
}