package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var rdr = bufio.NewReaderSize(os.Stdin, 1000000) func main() { sc.Split(bufio.ScanWords) t := nextInt() ss := make([]string, t) for i := range ss { ss[i] = nextLine() } g, p := []byte("good"), []byte("problem") for _, s := range ss { n := len(s) min := 20 for i := 0; i < n-10; i++ { for j := i + 4; j < n-6; j++ { c := 0 for k, v := range g { if s[i+k] != v { c++ } } for k, v := range p { if s[j+k] != v { c++ } } if c < min { min = c } } } fmt.Println(min) } } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i }