Java 452 444 433 430
import java.util.*;
interface L{
static void main(String[]a){
Map<Character,Integer>m=new HashMap<>();
for(char c:a[0].toLowerCase().toCharArray())if(96<c&&c<123) m.merge(c,1,(j,i)->j+i);
int l=String.valueOf(m.values().stream().reduce(0,Integer::max)).length();
m.entrySet().stream().sorted((e,f)->e.getValue()-f.getValue())
.forEachOrdered(e->System.out.println(e.getKey()+"-"+String.format("%"+l+"s",e.getValue())));
}}
My first contribution. I know Java will never win this kind of challenges but until now it is at least the shortest java response :)
First argument is used as input. If it contains spaces, it has to be quoted(")
Explained:
// there is not a lot you get for free, so import you will
import java.util.*;
interface L{
static void main(String[]a) { // java main entry point
Map<Character,Integer> m=new HashMap<>(); // key=character, value=number of occurances in input text
for(char c: // for each character in
a[0] // take first argument from command line
.toLowerCase() // convert all characters to lowercase
.toCharArray()) // convert to array so we can loop over it
if(96<c&&c<123) // accept only a-z
m.merge(c, 1, (j,i)->j+i); // fill map, increase corresponding value
int l=String.valueOf( // l: to store length of counter
m.values().stream() // loop over counter values
.reduce(0,Integer::max)) // find max value
.length(); // count number of digits of max value
m.entrySet().stream() // loop over the counter map
.sorted((e,f)->e.getValue()-f.getValue()) // sort the map by value ascending
.forEachOrdered( // loop over the ordered result
e->System.out.println( // print for every entry
e.getKey() // - the key
+"-"
+String.format("%"+l+"s", // - format using l
e.getValue()))); // the value
}}
452 -> 444 : removed spaces
444 -> 433 : class-> interface, public
433 -> 430: 96<c&c<123 (thanks @ceilingcat)