import * as fs from 'fs'; const input = fs.readFileSync('/dev/stdin', 'utf8'); const arr = input.split(/[ \n]/); let M = parseInt(arr[1]); let N = parseInt(arr[0]); let answer = 0; for (let i = 2; i <= N + 2; i++) { let row = arr[i].split(''); for (let j = 0; j < M; j++) { if (row[j] === "W") { answer = answer + 1; } } } console.log(answer);