#include <stdio.h>
#define MAX 200000
int func(int a, int b, int c, int d, int dp[19][19][19][19]);
int min4(int a, int b, int c, int d);

int min(int a, int b);
int main()
{
    int h, w;
    long maxi;
    char S[21][21];
    int dp[19][19][19][19] = {0};
    scanf("%d %d", &h, &w);
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {

            S[i][j] = getchar();
        }
        getchar(); // get the Enter
    }
    printf("scanf okey\n");
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (i == 19)
            {
                dp[i][j][i][j + 1] = 1;
            }
            else if (j == 19)
            {
                dp[i][j][i + 1][j] = 1;
            }
            else
            {
                dp[i][j][i + 1][j] = 1;
                dp[i][j][i][j + 1] = 1;
            }
        }
    }
    int k = 0;
    for (int i = 0; i < 20; i++)
    {
        for (int j = 0; j < 20; j++)
        {
            if (S[i][j] == '#')
            {
                continue;
            }
            for (int c = i; c < 20; c++)
            {
                for (int d = j; d < 20; d++)
                {
                    if (S[i][j] == '#')
                    {
                        continue;
                    }

                    k = func(i, j, c, d, dp[19][19][19][19]);
                    if (k > maxi)
                    {
                        maxi = k;
                    }
                }
            }
        }
    }
    printf("%ld", maxi);
    return 0;
}

int func(int a, int b, int c, int d, int dp[19][19][19][19])
{

    if (dp[a][b][c][d] == 0)
    {
        dp[a][b][c][d] = 1;
        if (c == 0 & d == 0)
        {
            dp[a][b][c][d] += min(func(a, b, c + 1, d, dp[19][19][19][19]), func(a, b, c, d + 1, dp[19][19][19][19]));
        }
        else if (c == 19 && d == 19)
        {
            dp[a][b][c][d] += min(func(a, b, c - 1, d, dp[19][19][19][19]), func(a, b, c, d - 1, dp[19][19][19][19]));
        }
        else if (c == 0)
        {
            dp[a][b][c][d] += min(func(a, b, c, d - 1, dp[19][19][19][19]), min(func(a, b, c + 1, d, dp[19][19][19][19]), func(a, b, c, d + 1, dp[19][19][19][19])));
        }
        else if (d == 0)
        {
            dp[a][b][c][d] += min(func(a, b, c - 1, d, dp[19][19][19][19]), min(func(a, b, c + 1, d, dp[19][19][19][19]), func(a, b, c, d + 1, dp[19][19][19][19])));
        }
        else if (c == 19)
        {
            dp[a][b][c][d] += min(func(a, b, c, d + 1, dp[19][19][19][19]), min(func(a, b, c - 1, d, dp[19][19][19][19]), func(a, b, c, d - 1, dp[19][19][19][19])));
        }
        else if (d == 19)
        {
            dp[a][b][c][d] += min(func(a, b, c + 1, d, dp[19][19][19][19]), min(func(a, b, c - 1, d, dp[19][19][19][19]), func(a, b, c, d - 1, dp[19][19][19][19])));
        }
        else
        {
            dp[a][b][c][d] += min4(func(a, b, c, d - 1, dp[19][19][19][19]), func(a, b, c, d + 1, dp[19][19][19][19]), func(a, b, c - 1, d, dp[19][19][19][19]), func(a, b, c + 1, d, dp[19][19][19][19]));
        }
    }
    return dp[a][b][c][d];
}

int min4(int a, int b, int c, int d)
{
    int min1, min2;
    min1 = min(a, b);
    min2 = min(c, d);
    return min(min1, min2);
}
int min(int a, int b)
{
    return (a < b) ? a : b;
}