This question is the sequel to the question countstars.
In countstars, you were tasked to count how many (*) there are in the input. Howver, we are now going to count constellations.
Each constellation is known as a group of stars which should be connected to each other either vertically or horizontally (no diagonal).
The first line of input will be 2 integers, h and w, which is the height(h) and width(w) of the rectangular area of sky you will be counting constellations from. You may assume their values are below 1000.
The following h lines will have w characters per line, either x (Clear Sky) or * (star).
Output a single integer, representing the amount of constellations (group of stars *) there are in the night sky.