atcoder#ABC274B. [ABC274B] Line Sensor

[ABC274B] Line Sensor

Score : 200200 points

Problem Statement

There is a grid with HH rows from top to bottom and WW columns from left to right. Let (i,j)(i, j) denote the square at the ii-th row from the top and jj-th column from the left. The squares are described by characters Ci,jC_{i,j}. If Ci,jC_{i,j} is ., (i,j)(i, j) is empty; if it is #, (i,j)(i, j) contains a box.

For integers jj satisfying 1jW1 \leq j \leq W, let the integer XjX_j defined as follows.

  • XjX_j is the number of boxes in the jj-th column. In other words, XjX_j is the number of integers ii such that Ci,jC_{i,j} is #.

Find all of X1,X2,,XWX_1, X_2, \dots, X_W.

Constraints

  • 1H10001 \leq H \leq 1000
  • 1W10001 \leq W \leq 1000
  • HH and WW are integers.
  • Ci,jC_{i, j} is . or #.

Input

The input is given from Standard Input in the following format:

HH WW

C1,1C1,2C1,WC_{1,1}C_{1,2}\dots C_{1,W}

C2,1C2,2C2,WC_{2,1}C_{2,2}\dots C_{2,W}

\vdots

CH,1CH,2CH,WC_{H,1}C_{H,2}\dots C_{H,W}

Output

Print X1,X2,,XWX_1, X_2, \dots, X_W in the following format:

X1X_1 X2X_2 \dots XWX_W

3 4
#..#
.#.#
.#.#
1 2 0 3

In the 11-st column, one square, (1,1)(1, 1), contains a box. Thus, X1=1X_1 = 1. In the 22-nd column, two squares, (2,2)(2, 2) and (3,2)(3, 2), contain a box. Thus, X2=2X_2 = 2. In the 33-rd column, no squares contain a box. Thus, X3=0X_3 = 0. In the 44-th column, three squares, (1,4)(1, 4), (2,4)(2, 4), and (3,4)(3, 4), contain a box. Thus, X4=3X_4 = 3. Therefore, the answer is (X1,X2,X3,X4)=(1,2,0,3)(X_1, X_2, X_3, X_4) = (1, 2, 0, 3).

3 7
.......
.......
.......
0 0 0 0 0 0 0

There may be no square that contains a box.

8 3
.#.
###
.#.
.#.
.##
..#
##.
.##
2 7 4
5 47
.#..#..#####..#...#..#####..#...#...###...#####
.#.#...#.......#.#...#......##..#..#...#..#....
.##....#####....#....#####..#.#.#..#......#####
.#.#...#........#....#......#..##..#...#..#....
.#..#..#####....#....#####..#...#...###...#####
0 5 1 2 2 0 0 5 3 3 3 3 0 0 1 1 3 1 1 0 0 5 3 3 3 3 0 0 5 1 1 1 5 0 0 3 2 2 2 2 0 0 5 3 3 3 3