[COCI2006-2007#2] STOL

题意翻译

## 题目描述 米尔科买了一套别墅,他想要邀请尽量多的人和他一起庆祝。他需要一张大的木质矩形桌子来让他和他的嘉宾坐下。每张桌子可容纳的人数等于它的周长(四边长度的总和)。米尔科想要买一张即可在他的公寓里放下,也可以坐下尽量多的人和他一起享用晚餐的桌子。桌子必须放置成四条边都与公寓的墙平行的样子。题目给出公寓内部的布局,请问米尔科最多可以邀请多少人吃晚餐。 ## 输入输出格式 ### 输入格式: 第一行包含两个整数R和S(1<=R,S<=400),代表公寓的尺寸(R为宽,S为长),以下的R行中每一行都包含了S个准确的字符(没有空格),代表这个正方形区域是没有东西的('.') ,还是有东西的('X'),米尔科只等把桌子发在没有东西的正方形区域里。 ### 输出格式 输出米尔科在放下他的桌子后能够邀请来吃晚餐的人数 感谢@marcoolmap 提供的翻译

题目描述

Mirko has bought an apartment and wants to invite to dinner as many people as possible to celebrate with him. For this he needs a large rectangular wooden table for which he will sit down with his guests. 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 such that it fits in his apartment and that as many people as possible can sit down with him for dinner. The table must be placed so that its edges are parallel to the edges of the apartment. Given the layout of the apartment, find the number of people Mirko can invite to dinner.

输入输出格式

输入格式


The first line contains two integers R and C (1 ≤ R, S ≤ 400), the dimensions of the apartment. Each of the following R rows contains exactly S characters (without spaces), whether a square is free ('.') or blocked ('X'). Mirko can put his table only in free squares.

输出格式


Output the number of guests Mirko can invite to dinner after he buys his table on a single line.

输入输出样例

输入样例 #1

2 2
..
..

输出样例 #1

7

输入样例 #2

4 4
X.XX
X..X
..X.
..XX

输出样例 #2

9

输入样例 #3

3 3
X.X
.X.
X.X

输出样例 #3

3