let input = require('fs').readFileSync('/dev/stdin', 'utf8'); const [N,M,...S] = input.split(/\s/); console.log(S.join``.match(/W/g).length);