output is right,but not verfying
package com.codegym.task.task18.task1821;
/*
Symbol frequency
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException {
TreeMap<Character, Integer> map = new TreeMap<>();
// BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// String m = bf.readLine();
BufferedReader reader = new BufferedReader(new FileReader(args[0]));
while (reader.ready()) {
String s = reader.readLine();
char[] chars = s.toCharArray();
for (char ch : chars) {
Integer count = map.get(ch);
if (count == null) {
count = 1;
} else {
count++;
}
map.put(ch, count);
}
}
ArrayList<Integer> list=new ArrayList<>();
for(char i:map.keySet()){
list.add((int) i);
}
Collections.sort(list);
for(int i:list){
System.out.println((char) i + " "+map.get((char) i));
//System.out.print(" "+map.get((char) i));
}
// for (Map.Entry<Character, Integer> entry : map.entrySet()) {
// System.out.println(entry.getKey() + " " + entry.getValue());
// }
reader.close();
}
}