#include using namespace std; int main() { int n, m; cin >> n >> m; string tmp; int ct = 0; for (int i = 0; i < n; i++) { cin >> tmp; for (int j = 0; j < m; j++) { if (tmp[j] == 'W') { ct++; } } } cout << ct << endl; return 0; }