#include // std::string #include // std::cout #include #include using namespace std; int n; int m; vector a; int sol = -1; int main() { string tmp; getline(cin, tmp); stringstream ss(tmp); ss >> n; ss >> m; for(int i=0; i 0) if (c[i-1][j] + 1 > c[i][j] && a[i - 1][j] != '&') c[i][j] = c[i-1][j]+1; if (j > 0) if (c[i][j-1] + 1 > c[i][j] && a[i][j-1] != '&') c[i][j] = c[i][j-1]+1; if (c[i][j] > sol) sol=c[i][j]; } cout << sol + 1; return 0; } /* 4 4 ..&. ..&. ..&. ..&. */