package main import ( "bufio" "fmt" "os" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) inm := 1145141919810 s := Scanner() ans := inm for i := 0; i < len(s)-2; i++ { for j := i + 1; j < len(s)-1; j++ { for k := j + 1; k < len(s); k++ { if s[i] == 'c' && s[j] == 'w' && s[k] == 'w' { ans = min(ans, k-i+1) } } } } if ans == inm { ans = -1 } fmt.Println(ans) } func min(x int, y int) int { if x >= y { return y } else { return x } }