DWITE Contest

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

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


Input

FTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTT
TTTTTTTTTF
----------
..........
..........
..........
TTT.T.TTT.
T...T.T.T.
TT..T.TTT.
T...T.T.T.
T...T.T..T
..........
..........
----------
..........
..........
TTTTTT....
.FFFFTTTTT
TTTTTT..TT
........TT
........TT
TTTTTTTTTT
..........
........F.
----------
....T.....
....F.....
....T.....
....T.....
....T.....
TTTTFTTTTT
....T.....
....T.....
....T.....
....F.....
----------
TFFFFFFFFF
FTFFFFFFFF
FFTFFFFFFF
FFFTFFFFFF
FFFFTFFFFF
FFFFFTFFFF
FFFFFFTFFF
FFFFFFFTFF
FFFFFFFFTF
FFFFFFFFFT
----------




Output

9
-1
16
5
1