|
|
- package main
-
- import "fmt"
-
- func main() {
-
- words := map[string]int{
- "Gonna": 3,
- "You": 3,
- "Give": 2,
- "Never": 1,
- "Up": 4,
- }
-
- max_word := ""
- max_count := 0
-
- for word, count := range words {
- if count > max_count {
- max_word, max_count = word, count
- }
- }
-
- fmt.Println("Most popular word:", max_word)
- fmt.Println("With a count of:", max_count)
-
- }
|