const lines = require('fs') .readFileSync('/dev/stdin', 'utf-8') .trim().split('\n').values(); const [N, _] = lines.next().value .split(' ').map(x => Number(x)); let A = ''; for (let i = 0; i < N; i++) { A += lines.next().value; } console.log([...A].reduce((a, x) => a + Number(x === 'W'), 0));