#include #include using namespace std; const int nmax = 100; int dl[2] = { 1, 0 }; int dc[2] = { 0, 1 }; char y[nmax+2][nmax+2]; long long a[nmax+2][nmax+2]; struct poz{ long long x, y; }; queue q; inline poz str_mk( long long l, long long c ) { poz s; s.x = l; s.y = c; return s; } int main() { long long n, m, mx, l, c; poz t; cin>>n>>m; for( long long i = 1; i <= n; ++ i ) { for( long long j= 1; j<= m ; ++j ) { cin>>y[i][j]; } } q.push( str_mk( 1, 1 ) ); mx = 0; a[1][1] = 1; while ( !q.empty() ) { t = q.front(); q.pop(); for ( long long k = 0; k < 2; ++ k ) { l = t.x + dl[k]; c = t.y + dc[k]; if ( y[l][c] == '.' ) { a[l][c] = a[t.x][t.y] + 1; if ( a[l][c] > mx ) mx = a[l][c]; q.push( str_mk( l, c ) ); } } } cout<