Farmer John has set up a puzzle for his cows to solve. At the
entrance to the barn, he has laid out an H x W (1
输入格式
Line 1: Two integers: H and W
Lines 2..H+1: Each line contains W characters, without spaces,
representing a row in the grid. The first row is the top row.
The first character in each row is the left-most character.
输出格式
Line 1: The number of cows that can enter the barn without repeating
a path.
样例
样例输入
3 4
TXXO
TXQT
XTXQ
样例输出
4
OUTPUT DETAILS:
4 cows can enter the barn, each one spelling out one of the 'TO's.