n = io.read("*n", "*l") sum = 0 for i = 1, n do s = io.read() for v in string.gmatch(s, "W") do sum = sum + 1 end end print(sum)