board = []
for i in range(8):
board.append(list(map(str, input())))
res = 0
for i in range(8):
for j in range(8):
if (i + j) % 2 == 0:
if board[i][j] == 'F':
res += 1
print(res)
board = []
for i in range(8):
board.append(list(map(str, input())))
res = 0
for i in range(8):
for j in range(8):
if (i + j) % 2 == 0:
if board[i][j] == 'F':
res += 1
print(res)