Go example: slices and maps

Count word occurrences using slices, maps and sorting in Go.

Demonstrates the core Go collection types. It counts how often each word appears by incrementing values in a map[string]int, then collects the unique keys into a slice and sorts them with sort.Strings so the output is stable. Finally it prints each count with fmt.Printf and joins the keys into one line using strings.Join.

Output

Errors