While testing on IntelliJ it works fine, output is also fine.
Any help?
package com.codegym.task.task18.task1821;
/*
Symbol frequency
*/
import java.io.*;
import java.util.Map;
import java.util.TreeMap;
public class Solution {
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader reader = new BufferedReader(new FileReader(args[0]));
TreeMap<Character,Integer> map = new TreeMap<>();
int counter = 0;
while (reader.ready()) {
String data = reader.readLine();
char[] arr = data.toCharArray();
for (int i = 0; i<arr.length; i++) {
for (int j = 0; j<arr.length; j++) {
if (arr[i] == arr[j]) {
counter++;
}
}
map.put(arr[i],counter);
counter = 0;
}
}
reader.close();
for (Map.Entry<Character,Integer> copy : map.entrySet()) {
System.out.println(copy.getKey()+ " "+copy.getValue());
}
}
}