#include using namespace std; int main(){ int N, M, i, j, cnt = 0; vector str; string tmp; cin >> N >> M; while(cin >> tmp){ str.push_back(tmp); } for(i = 0; i < N; i++){ for(j = 0; j < M; j++){ if(str[i][j] == 'W'){ cnt++; } } } cout << cnt << endl; return 0; }