Under construction

Still being built. Things may change

Emacs

Interview

Time limit1sMemory limit512 MB

Summary
Count the non-overlapping, non-touching rectangles of '*' characters in an N by M grid.
Level

Medium4 of 10

Topics
Implementation, Array, BFS, DFS
Solved
No attempts yet

Problem

While playing in his favourite text editor, Daniel decided to draw a picture that is N characters high and M characters wide. The picture consists solely of the characters '.' and '*', and the '*' characters form some non-overlapping rectangles. The rectangles do not touch each other, not even on their sides or corners.

Help Daniel count the number of rectangles drawn in the picture.

Input

The first line contains two integers N and M (1 ≤ N, M ≤ 100). Each of the next N lines contains M characters '.' or '*', representing the picture Daniel drew.

Output

Print the number of rectangles in the picture on a single line.

Examples3

  1. Example 1

    Input
    6 7
    ***....
    ***..**
    .....**
    .***.**
    .***...
    .***...
    
    Expected output
    3
    
  2. Example 2

    Input
    3 3
    *.*
    ...
    *.*
    
    Expected output
    4
    
  3. Example 3

    Input
    1 10
    .*.**.***.
    
    Expected output
    3