defmodule Main do def main do IO.read(:line) |> String.trim() |> solve |> IO.puts() end def solve(s) do t = [ s |> String.length() | Regex.scan(~r/(?=(c[^cw]*?w[^w]*?w))/, s) |> Enum.map(fn [_, x] -> x |> String.length() end) ] cond do t |> length == 1 -> -1 true -> t |> Enum.min() end end end