#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair pii; #define ll long long #define INF 1e9 int mat[101][101]; int n, m; int f(int x, int y){ if(x< 0 || x>=n || y<0 || y>=m || mat[x][y]==-1) return 0; if(mat[x][y]>0) return mat[x][y]; return mat[x][y] = max(f(x+1, y), f(x,y+1))+1; } int main() { memset(mat, 0, sizeof(mat)); // freopen("C:\\in.txt", "r", stdin); cin >> n >> m; string line; for(int i=0; i> line; for(int j=0; j