
NFP is the future!, this is something all of Noa's friends can expect him to say when finance topics come up.
NFP is one of the cryptocurrencies. The value of NFP over the course of .
and #
. The character #
in the
....##.
#..#...
.##....
......#
The insecurity of NFP is defined as the difference between the maximum and minimum value it achieves
over the course of
Noa wants to determine the insecurity for
Help him determine the insecurity of each of the
Input Specification
The first line contains integers
.
, except for exactly one character #
.
Output Specification
Print
Constraints
Subtask | Points | Constraints |
---|---|---|
No additional constraints. |
Sample Input 1
4 2 2
##
..
..
##
#.
.#
.#
#.
Sample Output 1
0
0
1
1
Explanation for Sample Output 1
The values of the first and the second NFP do not change over the days, so their insecurities are equal to
Sample Input 2
1 5 8
.....#.#
...#..#.
..#.#...
.#......
#.......
Sample Output 2
4
Explanation for Sample Output 2
The maximum value NFP has is
Sample Input 3
2 3 3
...
##.
..#
.#.
#..
..#
Sample Output 3
1
2
Comments