import java.util.*;

public class Freq {

    public static void main(String args[]) {
        Map<String, Integer> m = new TreeMap<String, Integer>();

        // Initialize frequency table from command line
        for (String s : args) {
            Integer freq =  m.get(s);


	    if (freq == null) {
		freq = 0;
	    }
	    
	    m.put(s, freq + 1);
        }

        System.out.println(m.size() + " distinct words detected:");
        System.out.println(m);
    }
}
