#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; ll a[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; ll ans = 0; FOR(i,0,n) FOR(j,0,m) { cin >> c; if (c == '&') continue; ll x = 0; if (i > 0) x = a[i-1][j]; if (j > 0) x = max(x,a[i][j-1]); a[i][j] = x+1; ans = max(ans,a[i][j]); } cout << ans << endl; return 0; }