#include <bits/stdc++.h>
using namespace std;
class triplet {
  long long int f, s, t;
};
vector<long long int> in(long long int n) {
  vector<long long int> v;
  long long int x;
  for (auto i = 0; i < n; i++) cin >> x, v.push_back(x);
  return v;
}
void out(vector<long long int> v) {
  for (auto i : v) cout << i;
}
void out(vector<long long int> v, char ch) {
  for (auto i : v) cout << i << ch;
}
char ar[20][20];
long long int most_distant(long long int H, long long int W, long long int maxh,
                           long long int maxw) {
  long long int count1 = 0, c2 = 0, c3 = 0, c4 = 0;
  if (ar[H - 1][W - 1] == '.') {
    count1 = 1 + most_distant(H - 1, W - 1, maxh, maxw);
  }
  if (ar[H - 1][W + 1] == '.') {
    c2 = 1 + most_distant(H - 1, W + 1, maxh, maxw);
  }
  if (ar[H + 1][W - 1] == '.') {
    c3 = 1 + most_distant(H + 1, W - 1, maxh, maxw);
  }
  if (ar[H + 1][W + 1] == '.') {
    c4 = 1 + most_distant(H + 1, W + 1, maxh, maxw);
  }
  return max(max(count1, c2), max(c3, c4));
}
map<long long int, long long int> m;
void solve() {
  long long int H, W, ans = 0;
  cin >> H >> W;
  for (auto i = 0; i < H; i++)
    for (auto j = 0; j < W; j++) {
      cin >> ar[i][j];
      if (ar[i][j] == '.') m[i] = j;
    }
  for (auto i : m) {
    ans = max(ans, most_distant(i.first, i.second, H, W));
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
