View difference between Paste ID: cT4NPTj3 and npJvpn6a
SHOW: | | - or go back to the newest paste.
1-
package main
1+
package main
2-
2+
3-
import (
3+
import (
4-
	"fmt"
4+
	"fmt"
5-
	"strings"
5+
	"strings"
6-
)
6+
)
7-
7+
8-
func main() {
8+
func main() {
9-
	s := "Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can."
9+
	s := "Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can."
10-
	firstOnly := make(map[int]struct{})
10+
	firstOnly := make(map[int]struct{})
11-
	for _, i := range []int{1, 5, 6, 7, 8, 9, 15, 16, 19} {
11+
	for _, i := range []int{1, 5, 6, 7, 8, 9, 15, 16, 19} {
12-
		firstOnly[i] = struct{}{}
12+
		firstOnly[i] = struct{}{}
13-
	}
13+
	}
14-
	result := make(map[string]int)
14+
	result := make(map[string]int)
15-
	for i, w := range strings.Split(s, " ") {
15+
	for i, w := range strings.Split(s, " ") {
16-
		var n int
16+
		var n int
17-
		if _, ok := firstOnly[i+1]; ok {
17+
		if _, ok := firstOnly[i+1]; ok {
18-
			n = 1
18+
			n = 1
19-
		} else {
19+
		} else {
20-
			n = 2
20+
			n = 2
21-
		}
21+
		}
22-
		result[w[:n]] = i + 1
22+
		result[w[:n]] = i + 1
23-
	}
23+
	}
24-
	fmt.Println(result)
24+
	fmt.Println(result)
25
}