P6866 [COCI 2019/2020 #5] Emacs

Description

Given an $n \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 $n$ and $m$. The next $n$ lines: the matrix described above. The matrix contains only `.` and `*`.

Output Format

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

Explanation/Hint

### Constraints - For $10$ pts of the testdata, each rectangle in the matrix contains only one `*`. - For another $15$ pts of the testdata, it is guaranteed that $n = 1$. - For all testdata, $1 \leq n, m \leq 100$. ### Notes **Translated from [COCI2019-2020](https://hsin.hr/coci/archive/2019_2020/) [CONTEST #5](https://hsin.hr/coci/archive/2019_2020/contest5_tasks.pdf) _T1 Emacs_**, translator: [90693](/user/90693)。 Translated by ChatGPT 5