package main import ( "fmt" "regexp" ) func main() { var S string fmt.Scan(&S) reg := regexp.MustCompile(`c.*?w.*w`) s := reg.FindString(S) l := -1 if len(s) > 0 { l = len(s) } fmt.Println(l) }