409698: GYM103687 M BpbBppbpBB

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. BpbBppbpBBtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Grammy has learned how to engrave stamps recently. She engraved two types of special stamps, type C has a capital letter "B" on it, and type S has a small letter "b" or a small letter "p" on it. The shapes and sizes of the stamps are illustrated in the following picture.

Grammy stamped these letters (with rotations) on a grid paper without overlapping, the letters can only be pressed at the piece of paper if it lies totally inside the piece of paper. However, Grammy forgot how many times she used each type of stamps. Please count the letters and help her to remember them.

The black part of the stamps may be adjacent but may not overlap.

Note that the stamps can be rotated to a multiple of $$$90$$$ degrees.

Input

The first line consists of two integers $$$n,m$$$ ($$$1\leq n,m \leq 1\,000$$$), representing the size of the paper.

In the following $$$n$$$ lines, each line consists of $$$m$$$ characters, representing the current state of the paper. "#" stands for a black square and "." stands for a white square.

Output

Output two integers, denoting the number of type C stamps and the number of type S stamps, respectively.

ExamplesInput
10 17
#################
#################
#################
####..#####..####
###....###....###
###....###....###
####..#####..####
#################
#################
#################
Output
1 0
Input
14 11
.##########
.##########
.##########
.####..####
.###....###
.###....###
.####..####
.##########
.##########
.##########
.###.......
.###.......
.###.......
.###.......
Output
0 1
Input
20 14
.##########...
.##########...
.##########...
.####..####...
.###....###...
.###....###...
.####..####...
.##########...
.##########...
.##########...
.#############
.#############
.#############
.#######..####
....###....###
....###....###
....####..####
##############
##############
##############
Output
0 2

加入题单

上一题 下一题 算法标签: