package main import "fmt" func main() { var s string fmt.Scan(&s) var c int w1 := len(s) + 1 w2 := len(s) + 2 ans := len(s) + 1 for j := len(s) - 1; j >= 0; j-- { if s[j] == 'w' { w1, w2 = j, w1 } if s[j] == 'c' { c = j if w2 < len(s) { ans = minInt(ans, w2-c+1) } } } if ans == len(s)+1 { ans = -1 } fmt.Println(ans) } func minInt(a, b int) int { if a < b { return a } else { return b } }