defmodule Main do def main do [n, m] = IO.gets("") |> String.trim |> String.split |> Enum.map(&String.to_integer/1) a = for _ <- 1..n, do: IO.gets("") |> String.trim ans = a |> Enum.flat_map(&String.graphemes/1) |> Enum.map(&( case &1 do "W" -> 1 _ -> 0 end )) |> Enum.sum IO.puts ans end end