adventofcode/04dec/main.go
2017-12-04 13:19:52 +01:00

40 lines
518 B
Go

package main
import (
"bufio"
"fmt"
"os"
"strings"
)
var in string
func main() {
fmt.Scanf("%s", &in)
sum := 0
in := bufio.NewScanner(os.Stdin)
for in.Scan() {
if checkPassphrase(in.Text()) {
sum++
}
}
fmt.Println(sum)
}
func checkPassphrase(d string) bool {
//fmt.Println(d)
words := strings.Split(d, " ")
for i, e := range words {
if i > 0 {
//fmt.Println(i, e)
for _, f := range words[0:i] {
//fmt.Println(e, f)
if f == e {
return false
}
}
}
}
return true
}