Problem:
Score : 400 points

Problem Statement

There is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.

Snuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.
The lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.
In each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.

Snuke wants to maximize the number of squares lighted by the lamp.

You are given H strings S_i (1 \leq i \leq H), each of length W. If the j-th character (1 \leq j \leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.

Find the maximum possible number of squares lighted by the lamp.

Constraints

1 \leq H \leq 2,000

1 \leq W \leq 2,000

S_i is a string of length W consisting of # and ..

. occurs at least once in one of the strings S_i (1 \leq i \leq H).

Input

Input is given from Standard Input in the following format:

H W
S_1
:
S_H

Output

Print the maximum possible number of squares lighted by the lamp.

Sample Input 1

4 6
#..#..
.....#
....#.
#.#...

Sample Output 1

8

If Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.

Sample Input 2

8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#

Sample Output 2

13

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
#define INF (1<<29)
using namespace std;


int H,W;
int cnt;
char S[2001][2001];
ll lights[2001][2001][2];

int count_ver(int i,int j){
  int cnt = 0;
  for(int x=i;x<W;x++){
    if (S[j][x] == '.') {
      cnt ++;
    }
    else{
      break;
    }
  }
  for(int x=i;x<W;x++){
    if (S[j][x] == '.') {
      lights[j][x][0] = cnt;
    }
    else{
      break;
    }
  }
  return cnt;
}


int count_hor(int i,int j){
  cnt = 0;
  for(int y=j;y<H;y++){
    if (S[y][i] == '.') {
      cnt ++;
    }
    else{
      break;
    }
  }
  for(int y=j;y<H;y++){
    if (S[y][i] == '.') {
      lights[y][i][1] = cnt;
    }
    else{
      break;
    }
  }
  return cnt;
}

int main(){
  cin>>H>>W;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin>>S[i][j];
    }
  }

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      for(int k=0;k<2;k++){
        lights[i][j][k] = 0;
      }
    }
  }
  int ans = -1;
  int ver = 0,hor =0 ;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      // cout<<S[i][j]<<endl;
      if(S[i][j] == '.'){
        ver = lights[i][j][0];
        hor = lights[i][j][1];
        if(ver==0){
          ver = count_ver(j,i);
        }
        if(hor==0){
          hor = count_hor(j,i);
        }
        ans = max(ans,hor+ver-1);
        // cout<<ans<<endl;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}