#P6866. [COCI 2019/2020 #5] Emacs

[COCI 2019/2020 #5] Emacs

Description

Given an n×mn \times m matrix containing only . and *.

The * cells in the matrix form some non-overlapping rectangles. They do not touch at edges or corners.

How many rectangles are there?

Input Format

The first line: two positive integers nn and mm.

The next nn lines: the matrix described above. The matrix contains only . and *.

Output Format

Output one non-negative integer in one line, your answer.

6 7
***....
***..**
.....**
.***.**
.***...
.***...

3
3 3
*.*
...
*.*

4
1 10
.*.**.***.

3

Hint

Constraints

  • For 1010 pts of the testdata, each rectangle in the matrix contains only one *.
  • For another 1515 pts of the testdata, it is guaranteed that n=1n = 1.
  • For all testdata, 1n,m1001 \leq n, m \leq 100.

Notes

Translated from COCI2019-2020 CONTEST #5 T1 Emacs, translator: 90693

Translated by ChatGPT 5