#include using namespace std; int main() { int n, m; cin >> n >> m; vector> v(n, vector(m)); int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { char c; cin >> c; if (c == 'W') cnt++; v.at(i).at(j) = c; } } cout << cnt << endl; }