#include #include #include #include #include using namespace std; typedef long long int lli; typedef pair ii; templatebool chmax(T &a, const T &b) { if( a < b ) { a = b; return 1; } return 0;} templatebool chmin(T &a, const T &b) { if( b < a ) { a = b; return 1; } return 0;} #ifdef LOCAL #define eprintf(...) printf(__VA_ARGS__) #else #define eprintf(...) 1 #endif #define ROUNDUP(a, b) ( ((a) + ((b) - 1) ) / (b)) #define SET_ZERO(a) ( memset((a), 0, sizeof(a))) #define SET_NUM_ARRAY(a,b) ( memset((a), b, sizeof(a))) //#define int long long int //dont forget to change int to signed const int INT_INF = 1000000007; int main() { int N, M; cin >> N >> M; int ctr = 0; for (int i = 0; i < N; i++) { char s[59]; cin >> s; for (int j = 0; j < M; j++) { if (s[j] == 'W') { ctr++; } } } cout << ctr << endl; return 0; }