ppackage com.javarush.task.task18.task1823; import java.util.HashMap; import java.util.Map; import java.io.*; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /* Нити и байты */ public class Solution { public static Map<String, Integer> resultMap = new HashMap<String, Integer>(); public static void main(String[] args)throws IOException{ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); while(true){ String st = bufferedReader.readLine(); if(st.equals("exit")){ break;} new ReadThread(st).start(); } bufferedReader.close(); } public static class ReadThread extends Thread { String fileName; public ReadThread(String fileName) throws FileNotFoundException { this.fileName = fileName; } public void run(){ try { int count = 0; int max = 0; int byTen = 0; File file = new File(fileName); FileInputStream inputStream = new FileInputStream(file); ArrayList<Integer> list = new ArrayList<>(); while (inputStream.available()>0) { int readfile = inputStream.read(); list.add(readfile); inputStream.close(); for(int i = 0;i<list.size();i++){ int a = list.get(i); for(int g = 0;g<list.size();g++){ int b = list.get(g); if(b==a){ count++; } } if(max<count){max = count;} count=0; } synchronized(resultMap){ resultMap.put(fileName,max); } max = 0; } }catch(IOException e){ } } } }