import numpy as np def count(N,M): num=0 for i in range(N): for j in range(M): if A[i][j] == 'W': num += 1 return num """ #入力ゾーン num =0 A = [] matrix = [] with open('712_1.txt','r') as f: for line in f: num+=1 if num==1: matrix=line.split() row = int(matrix[0]) column = int(matrix[1]) else: A.append(str(line.strip())) """ #入力(手入力) matrix = input().split() A = [] row = int(matrix[0]) column = int(matrix[1]) for i in range(int(matrix[0])): A.append(input()) #出力ゾーン print('塗る回数',count(row,column))