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