logo AlgoBeat OnlineJudge
登录 注册

#213749. [NWRRC 2021] Letters Q and F

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Little Lev is learning how to draw letters and . Initially, he has a white grid of size . Then he will draw several letters of one of the following two shapes:

Lev will not rotate or mirror these two shapes. Every time he draws a new letter, he will choose a position for the letter inside the grid and paint all cells of the shape black. Lev will only draw letters in such a way that before drawing all black cells of the letter are white --- that is, he will never paint a cell twice.

You are given the final coloring of the grid. Count the number of letters and letters drawn by Lev.

输入格式

The first line contains two integers and --- the height and the width of the grid (; ).

The next lines contain characters each, denoting the final state of the grid. A white cell is denoted by , a black cell is denoted by .

It is guaranteed that the grid is a valid result of Lev's drawing.

输出格式

Print two integers --- the number of letters and the number of letters drawn by Lev, respectively.

样例

样例输入 1

5 3
###
#.#
###
..#
..#

样例输出 1

1 0

样例输入 2

5 3
###
#..
##.
#..
#..

样例输出 2

0 1

样例输入 3

5 8
###..###
#.#..#..
###..##.
..#..#..
..#..#..

样例输出 3

1 1

样例输入 4

8 8
.....###
###..#.#
#.######
###.####
#.###.##
#.#.###.
..#...#.
......#.

样例输出 4

2 2

数据范围与提示

Illustration for the fourth example test: