atcoder#ABC280A. [ABC280A] Pawn on a Grid
[ABC280A] Pawn on a Grid
Score : points
Problem Statement
There is a grid with rows from top to bottom and columns from left to right. Each square has a piece placed on it or is empty.
The state of the grid is represented by strings , each of length .
If the -th character of is #
, the square at the -th row from the top and -th column from the left has a piece on it;
if the -th character of is .
, the square at the -th row from the top and -th column from the left is empty.
How many squares in the grid have pieces on them?
Constraints
- and are integers.
- is a string of length consisting of
#
and.
.
Input
The input is given from Standard Input in the following format:
Output
Print the number of squares with pieces as an integer.
3 5
#....
.....
.##..
3
The following three squares have pieces on them:
- the square at the -st row from the top and -st column from the left;
- the square at the -rd row from the top and -nd column from the left;
- the square at the -rd row from the top and -rd column from the left.
Thus, should be printed.
1 10
..........
0
Since no square has a piece on it, should be printed.
6 5
#.#.#
....#
..##.
####.
..#..
#####
16