Counting Sheep (Easy)#1200

Counting Sheep (Easy)

1 second
64 megabytes
Medium

A while ago, I had trouble sleeping. I used to lie awake, staring at the ceiling for hours. One day, my grandmother suggested that I try counting sheep after going to bed. As always, when my grandmother suggests things, I decided to try. The only problem was, there were no sheep to count when I went to bed.

Being creative, this did not stop me. I wrote a program that generated a grid of characters, where '#' represents a sheep, and '.' represents grass (or anything else, but not a sheep). To make the counting more interesting, I decided to count flocks of sheep instead of individual sheep. Two sheep are in the same flock if they share a common side (up, down, right, or left). Also, if sheep is in the same flock as , and is in the same flock as , then and are also in the same flock.

Now I have a new problem. While counting sheep actually helps me fall asleep, it has become very boring. To solve this, I need another program that will do the counting for me. I want you to write this program for me.

Input

The first line contains (0 < T \leq 100), the number of test cases. Each test case starts with a line containing two numbers and (0 < H, W \leq 100) — the height and width of the grid. Then lines follow, each containing characters (either '#' or '.'), describing the grid.

Output

For each test case, output a single line with the number of sheep flocks according to the problem statement.

Examples

Example 1

Loading
Loading