package net.ipipip0129.yukicoder.No712; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int height = scan.nextInt(); int width = scan.nextInt(); int ans_cnt = 0; scan.nextLine(); for (int i = 0; i < height; i++) { String line = scan.nextLine(); for (char s : line.toCharArray()) { if (s == 'W') ans_cnt += 1; } } System.out.println(ans_cnt); } }