package main import ( "bufio" "fmt" "os" "strconv" ) func main() { var a int a = nextInt() for i := 0; i < a; i++ { solve() } } func solve() { //fmt.Println("---") var s string s = next() s_len := len(s) cost := 100 + s_len // p_cost := 0 // // "problem"のdiff()を計算しておく // diff_p := make([]int, s_len) // for j:=0; j= 7 { // if s[j-7:j] == "problem" { // p_cost++ // } // } // for k := j + 4; k < s_len-6; k++ { // cost = min(cost, diff(s[j:j+4], "good")+diff_p[k]+p_cost) // } // //fmt.Print(cost, " ") // } fmt.Println(cost) } func min(x, y int) int { if x > y { x = y } return x } func diff(s1, s2 string) int { c := 0 for i := 0; i < len(s1); i++ { if s1[i] != s2[i] { c++ } } return c } var s = bufio.NewScanner(os.Stdin) func next() string { s.Split(bufio.ScanWords) s.Scan() return s.Text() } func nextInt() int { i, e := strconv.Atoi(next()) if e != nil { panic(e) } return i } var rdr = bufio.NewReaderSize(os.Stdin, 10000000000) func readLine() string { buf := make([]byte, 0, 10000000000) for { l, p, e := rdr.ReadLine() if e != nil { panic(e) } buf = append(buf, l...) if !p { break } } return string(buf) }