题目描述
Problem Description
Mirko has bought an apartment and wants to invite as many people as possible to celebrate with him. For this, he needs a large rectangular wooden table where he and his guests can sit. The number of people a table can accommodate is equal to its perimeter (the sum of the lengths of all four sides). Mirko wants to buy a table that fits in his apartment and can accommodate as many people as possible for dinner. The table must be placed such that its edges are parallel to the edges of the apartment.
Given the layout of the apartment, determine the maximum number of people Mirko can invite to dinner.
Input Format
The first line contains two integers R and S (1 ≤ R, S ≤ 400), representing the dimensions of the apartment (R is the width, S is the length). Each of the following R rows contains exactly S characters (without spaces), indicating whether a square is free ('.') or blocked ('X'). Mirko can place his table only in free squares.
Output Format
Output a single line containing the number of guests Mirko can invite to dinner after placing his table.
Sample Input and Output
Sample Input #1
2 2
..
..
Sample Output #1
7
Sample Input #2
4 4
X.XX
X..X
..X.
..XX
Sample Output #2
9
Sample Input #3
3 3
X.X
.X.
X.X
Sample Output #3
3
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分