#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,a,b) for(int i=(a),_b=(b);i<(_b);++i) #define FORD(i,a,b) for(int i=(a),_b=(b);i>(_b);--i) #define pb push_back #define mp make_pair #define all(c) (c).begin(),(c).end() #define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) #define present(c,x) ((c).find(x) != (c).end()) #define cpresent(c,x) (find(all(c),x) != (c).end()) #define endl '\n' typedef long long ll; typedef unsigned long long ull; typedef unsigned char byte; typedef vector vi; typedef pair pii; typedef pair pll; typedef vector vpii; const int MX = 105; int a[MX][MX]; char g[MX][MX]; int main(int argc, char *argv[]) { #ifndef ONLINE_JUDGE freopen(argv[1],"r",stdin); #endif #ifndef ONLINE_JUDGE ifstream cin(argv[1]); #endif #if 0 ofstream cout(argv[2]); #endif ios :: sync_with_stdio(false); cin.tie(NULL); int n,m; cin >> n >> m; char c; FOR(i,0,n) FOR(j,0,m) cin >> g[i][j]; if (g[0][0] != '.') { cout << 0 << endl; return 0; } int dp[n][m]; dp[0][0] = 1; FOR(i,1,n) { dp[i][0] = 0; if (g[i][0] != '.') continue; dp[i][0] = dp[i-1][0]; } FOR(i,1,m) { dp[0][i] = 0; if (g[0][i] != '.') continue; dp[0][i] = dp[0][i-1]; } FOR(i,1,n) FOR(j,1,m) { dp[i][j] = 0; if (g[i][j] != '.') continue; dp[i][j] = dp[i-1][j]; dp[i][j] += dp[i][j-1]; } int ans = 0; FOR(i,0,n) FOR(j,0,m) if (dp[i][j]) ans = max(ans,i+j+1); cout << ans << endl; return 0; }