DWITE Contest

Test Case for Question #4 in DWITE 2011-2012 High School Round 3

Contest: DWITE 2011-2012 High School Round 3
Question: #4
Input File: DATA4.txt
Output File: OUT4.txt


Input

1 5
#ABC#
1 5
B.AC#
5 5
A....
.###.
.B...
.###.
.C...
5 5
.B...
.....
..A..
.....
...C.
10 10
##########
##..#..###
#.#...#.##
#..#.#..##
##..A..###
#..#C#..##
#.#...#.##
##..#..###
##B#######
##########




Output

4
6
12
12
12