#include #include #include #include using namespace std; int main() { int n, w; vector> flag; cin >> n >> w; flag.resize(n); for (int i = 0;i < n;i++) { flag[i].resize(n); } int count = 0; for (int i = 0;i < n;i++) { for (int j = 0;j < w;j++) { cin >> flag[i][j]; if (flag[i][j] == 'W')count++; } } cout << count << endl; return 0; }