defmodule Main do def input, do: IO.read(:line) |> String.trim def ii, do: input() |> String.to_integer def li, do: input() |> String.split |> Enum.map(&String.to_integer/1) def yn(b), do: IO.puts(if b, do: "Yes", else: "No") def main do s = input() |> String.to_charlist f(s, 0, -1) |> IO.puts end def f(xs, k, m) do case xs do [?p, ?a, ?i, ?n | ys] -> f(ys, 0, max(k-1, m)) [?p, ?o, ?n | ys] -> f(ys, k+1, m) [_ | ys] -> f(ys, k, m) [] -> m end end end