:)
package com.codegym.task.task18.task1804;
import java.io.FileInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
/*
Rarest bytes
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> intList = new ArrayList<>();
String fileName = reader.readLine();
FileInputStream inputStream = new FileInputStream(fileName);
while (inputStream.available() > 0) {
int temp = inputStream.read();
intList.add(temp);
}
inputStream.close();
Collections.sort(intList);
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
int count = 0;
int min = Integer.MAX_VALUE;
for (int i = 0; i < intList.size(); i++) {
for (int j = 0; j < intList.size(); j++) {
if (intList.get(i) == intList.get(j)) {
count++;
}
}
map.put(intList.get(i), count);
if(count < min){
min = count;
}
count = 0;
}
for (HashMap.Entry<Integer, Integer> entry : map.entrySet()) {
if (entry.getKey().equals(min)) {
System.out.print(entry.getKey() + " ");
}
}
}
}