Exercise: count characters - sort by frequency
- Given a string count how many time each character appears and list them by frequency.
- Make the count case-insensitive (so "T" and "t" will count as the same letter.)
examples/count-characters-by-frequency-skeleton/count_characters_by_frequency_skeleton.go
package main import ( "fmt" ) func main() { text := "This is a very long text. OK, maybe it is not that long after all." fmt.Println(text) }
Expected output:
This is a very long text. OK, maybe it is not that long after all. s: 3 r: 2 l: 4 n: 3 x: 1 .: 2 m: 1 h: 2 b: 1 v: 1 t: 7 T: 1 e: 4 o: 3 O: 1 K: 1 ,: 1 a: 5 y: 2 g: 2 f: 1 i: 4