#include #include #include using namespace std; int main(){ int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } int ans = 0; for (int i = 0; i < N; i++){ for (int j = 0; j < M; j++){ if (A[i][j] == 'W'){ ans++; } } } cout << ans << endl; }