Problem list
Log in
#coci00226 · COCI 2011/2012 Contest 6

Prozori

Silver IV 1.0 s 32 MB

Now that spring is here and the sun is shining bright, people are starting to lower their blinds. Štefica is an elderly woman who likes to keep track of what other people in the neighbourhood are doing and then talk about it behind their backs. This year, she is particularly interested in who is lowering blinds in the building across the street, and how low are they lowering them. We will represent each window with a 4 x 4 grid, with asteriskes representing lowered blinds. Štefica can see a window in one of the following 5 states: .... .... .... ....


.... .... ....



.... ....




....





The building across the street has N windows at each of the M floors. Given the current building state, find out how many windows are in each of the 5 states shown above.

Input

The first line of input contains space separated integers M and N ($1 \le M$, $N \le 100$). The following lines describe the current building state. Each window is represented with one of the 4 x 4 grids shown above, and windows are separated using character „#‟. See the example input for clarification. Building description will have exactly 5M + 1 lines each having 5N + 1 characters.

Output

Output should contain 5 space separated integers, number of windows for each type in order shown above. Sum of these numbers is $M*N$.

Example 1

Input
1 2
###########
#....#****#
#....#****#
#....#....#
#....#....#
###########
Output
1 0 1 0 0

Example 2

Input
2 3
################
#****#****#****#
#****#****#****#
#****#....#****#
#....#....#****#
################
#....#****#****#
#....#****#....#
#....#....#....#
#....#....#....#
################
Output
1 1 2 1 1
Source
COCI 2011/2012 Contest 6
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code