#include using namespace std; int a[105][105]; int main() {int i,j,n,m; char s[105]; cin>>n>>m; cin.get(); for(i=1;i<=n;i++) {cin.getline(s,103); j=0; while(s[j]){if(s[j]=='&')a[i][j+1]=0; else a[i][j+1]=1;j++;} } for(i=n;i>0;i--) for(j=m;j>0;j--) if(a[i][j]) a[i][j]=1+max(a[i][j+1],a[i+1][j]); cout<