#include "bits/stdc++.h" using namespace std; #define fastcin {\ cin.tie(0);\ ios::sync_with_stdio(false);\ } #define rep(i, a, b) for(int i = a; i < b; i++) #define print(x) cout << x << "\n" int main() { fastcin; int n, m, ans = 0; cin >> n >> m; rep(i, 0, n) { string s; cin >> s; rep(j, 0, m) { if(s[j]=='W') ans++; } } print(ans); return 0; }