Skip to content

Instantly share code, notes, and snippets.

@cipepser
Created December 29, 2016 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cipepser/9992125ab064053287a0dd4dd4ae4c0a to your computer and use it in GitHub Desktop.
Save cipepser/9992125ab064053287a0dd4dd4ae4c0a to your computer and use it in GitHub Desktop.
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