#P6438. [COCI 2011/2012 #6] PROZORI

[COCI 2011/2012 #6] PROZORI

Description

We represent a window blind as a 4×44 \times 4 square grid. In each row, all characters are either * or all are .. The blind can only be in the following five states:

The building opposite has nn floors, and each floor has mm windows. Given the representation of the windows in the building, find how many blinds there are in each of the five states above.

Input Format

The first line contains two integers, representing the number of floors nn and the number of windows per floor mm.

The next (5n+1)(5n + 1) lines each contain (5m+1)(5m + 1) characters describing the building’s windows. The window frames are represented by #, and the inside can only be one of the five states given above. You can read the sample to better understand the input format.

Output Format

Output one line with five integers separated by spaces, in order, representing how many blinds are in each of the five states above.

1 2
###########
#....#****#
#....#****#
#....#....#
#....#....#
###########

1 0 1 0 0
2 3
################
#****#****#****#
#****#****#****#
#****#....#****#
#....#....#****#
################
#....#****#****#
#....#****#....#
#....#....#....#
#....#....#....#
################

1 1 2 1 1

Hint

Explanation of Sample 1

  • The window whose top-left corner is at row 22, column 22, and bottom-right corner is at row 55, column 55 is a window in the first state.
  • The window whose top-left corner is at row 22, column 77, and bottom-right corner is at row 55, column 1010 is another window, in the third state.

Constraints

For all testdata, it is guaranteed that 1n,m1001 \leq n, m \leq 100.

Notes

This problem is translated from COCI2011-2012 CONTEST #6 T2 PROZORI. Translation by @一扶苏一.

Translated by ChatGPT 5