I look to help section to but still...
package com.codegym.task.task18.task1804;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
/*
Rarest bytes
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
InputStream inputStream= new FileInputStream(br.readLine());
ArrayList<Integer>list=new ArrayList<>();
while(inputStream.available()>0){
int data=inputStream.read();
list.add(data);
}
int count=0;
int minVar=Integer.MAX_VALUE;
Map<Integer, Integer>map=new HashMap<Integer, Integer>();
for(int i=0; i<list.size()-1; i++){
for(int j=i+1; j<list.size(); j++){
if(list.get(i)==list.get(j)) {
count++;
}
else
count=0;
}
map.put(list.get(i), count);
if(count<minVar) {
minVar = count;
}
}
for(Map.Entry<Integer, Integer>x:map.entrySet()){
if(x.getValue().equals(minVar))
System.out.print(x.getKey()+" ");
}
inputStream.close();
}
}