Не могу найти ошибку..
package com.javarush.task.task18.task1803;
import java.io.*;
import java.util.*;
/*
Самые частые байты
*/
public class Solution {
public static void main(String[] args) throws Exception {
List<Integer> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String a = reader.readLine();
FileInputStream inputStream = new FileInputStream(a);
// int max = (Collections.max);
while(inputStream.available()>0){
int data = inputStream.read();
list.add(data);
}
inputStream.close();
Collections.sort(list);
Map<Integer,Integer> bytes = new HashMap<>();
int count = 1;
for(int i = 0;i<list.size();i++){
if(list.get(i).equals(list.get(i+1))){
count++;
}
else{
bytes.put(list.get(i),count);
count =1;
}
}
int max = (Collections.max(bytes.values()));
for(Map.Entry<Integer,Integer> entry : bytes.entrySet()){
if(entry.getValue().equals(max)){
System.out.print(entry.getKey()+" ");
}
}
}
}