Last active
August 29, 2015 14:08
-
-
Save briandowns/18d323daab86bed3039a to your computer and use it in GitHub Desktop.
Word Count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func main() { | |
str := "olly olly in come free" | |
data := make(map[string]int) | |
for _, s := range strings.Split(str, " ") { | |
if _, ok := data[s]; ok { | |
data[s]++ | |
continue | |
} | |
data[s]++ | |
} | |
fmt.Println(data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment