Given the window states of the apartment across the street, count how many windows have each possible blind height.
Each window is represented as a 4×4 grid. * is a lowered part of the blind, and . is a visible part of the window. Only the following five states can appear; they have 0, 1, 2, 3, or 4 rows of * from the top.
0 rows:
....
....
....
....
1 row:
****
....
....
....
2 rows:
****
****
....
....
3 rows:
****
****
****
....
4 rows:
****
****
****
****
The apartment has M floors, and each floor has N windows. Given the current state of the whole apartment, determine how many windows are in each of the five states.
The first line contains two space-separated integers M and N. (1 ≤ M, N ≤ 100)
The next 5M+1 lines describe the apartment. Each line contains 5N+1 characters. Each window is a 4×4 grid, and # characters separate windows and form the borders.
Output five integers separated by spaces: the number of windows in each of the five states, in the order shown above. The sum of the five numbers must be M×N.