let ``No.345 最小チワワ問題``() = let s = stdin.ReadLine() let Windexes = s |> Seq.mapi (fun i c -> if c.Equals( 'w' ) then i + 1 else -1 ) |> Seq.filter (fun i -> i >= 0) |> Seq.pairwise s |> Seq.mapi (fun i c -> if c.Equals( 'c' ) then i else -1 ) |> Seq.filter (fun i -> i >= 0) |> Seq.map ( fun n -> Windexes |> Seq.tryFind (fun (t1, t2) -> t1 > n ) |> function | Some (x1,x2) -> x2 - n | None -> -1 ) |> Seq.min |> stdout.WriteLine ``No.345 最小チワワ問題``()