package algo; import java.util.ArrayList; import java.util.Scanner; import java.util.*; public class sample7 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int cnt = 0; for(int i=0; i < N; i++) { String str = sc.next(); char[] c = str.toCharArray(); for(char cc : c) { if(cc == 'W') { cnt++; } } } System.out.println(cnt); } }