open System open System.Text.RegularExpressions let pattern = new Regex(@"c[^cw]*w[^cw]*w") let searchCww str = pattern.Matches(str) |> function m when m.Count = 0 -> -1 | m -> seq { for i in 0..(m.Count - 1) -> m.[i].Length} |> Seq.min Console.ReadLine () |> searchCww |> printfn "%d"