My output is correct, yet the last requirement fails! Could someone tell me, why?
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
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 maxCount = 0;
for(int i = 0; i < list.size(); i++) {
int count = 0;
for (int j = 0; j < list.size(); j++) {
if (list.get(i).equals(list.get(j))) {
count++;
if(count > maxCount)
maxCount = count;
}
}
}
System.out.println(maxCount);
}
}