using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("4 6");
WillReturn.Add("#..#..");
WillReturn.Add(".....#");
WillReturn.Add("....#.");
WillReturn.Add("#.#...");
//8
}
else if (InputPattern == "Input2") {
WillReturn.Add("8 8");
WillReturn.Add("..#...#.");
WillReturn.Add("....#...");
WillReturn.Add("##......");
WillReturn.Add("..###..#");
WillReturn.Add("...#..#.");
WillReturn.Add("##....#.");
WillReturn.Add("#...#...");
WillReturn.Add("###.#..#");
//13
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
int[] wkArr = InputList[0].Split(' ').Select(pX => int.Parse(pX)).ToArray();
int UB_X = wkArr[1] - 1;
int UB_Y = wkArr[0] - 1;
char[,] BanArr = CreateBanArr(InputList.Skip(1).ToList());
int[,] CntArr = new int[UB_X + 1, UB_Y + 1];
// 横方向の連続マス数を足す
for (int Y = 0; Y <= UB_Y; Y++) {
var IndList = new List<int>();
for (int X = 0; X <= UB_X; X++) {
if (BanArr[X, Y] == '.') {
IndList.Add(X);
}
if (BanArr[X, Y] == '#' || X == UB_X) {
int Cnt = IndList.Count;
foreach (int EachInd in IndList) {
CntArr[EachInd, Y] += Cnt;
}
IndList.Clear();
}
}
}
// 縦方向の連続マス数を足す
for (int X = 0; X <= UB_X; X++) {
var IndList = new List<int>();
for (int Y = 0; Y <= UB_Y; Y++) {
if (BanArr[X, Y] == '.') {
IndList.Add(Y);
}
if (BanArr[X, Y] == '#' || Y == UB_Y) {
int Cnt = IndList.Count;
foreach (int EachInd in IndList) {
CntArr[X, EachInd] += Cnt;
}
IndList.Clear();
}
}
}
//PrintBan(CntArr);
int Answer = 0;
for (int X = 0; X <= UB_X; X++) {
for (int Y = 0; Y <= UB_Y; Y++) {
// 自分自身のマスをダブルカウントしてるので、マイナス1する
Answer = Math.Max(Answer, CntArr[X, Y] - 1);
}
}
Console.WriteLine(Answer);
}
// stringのListをcharの2次元配列に設定する
static char[,] CreateBanArr(List<string> pStringList)
{
if (pStringList.Count == 0) {
return new char[0, 0];
}
int UB_X = pStringList[0].Length - 1;
int UB_Y = pStringList.Count - 1;
char[,] WillReturn = new char[UB_X + 1, UB_Y + 1];
for (int Y = 0; Y <= UB_Y; Y++) {
for (int X = 0; X <= UB_X; X++) {
WillReturn[X, Y] = pStringList[Y][X];
}
}
return WillReturn;
}
// 2次元配列のデバッグ出力
static void PrintBan(int[,] pBanArr)
{
for (int Y = 0; Y <= pBanArr.GetUpperBound(1); Y++) {
for (int X = 0; X <= pBanArr.GetUpperBound(0); X++) {
Console.Write(pBanArr[X, Y]);
}
Console.WriteLine();
}
}
}