Created
December 29, 2016 07:53
-
-
Save cipepser/9992125ab064053287a0dd4dd4ae4c0a to your computer and use it in GitHub Desktop.
This file contains 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() { | |
var s string = "Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can." | |
s = strings.Replace(s, ".", "", -1) | |
dict := make(map[string]int) | |
for i, v := range strings.Split(s, " ") { | |
switch i + 1 { | |
case 1, 5, 6, 7, 8, 9, 15, 16, 19: | |
dict[string([]rune(v)[0])] = i | |
default: | |
dict[string([]rune(v)[0]) + string([]rune(v)[1])] = i | |
} | |
} | |
fmt.Println(dict) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment