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