//poj 1154 //sep9 #includeusing namespace std; const int maxR=32; char a[maxR][maxR]; int r,s; int ans=1; int vis[200]; void dfs(int i,int j,int len) { ans=max(ans,len+1); if(i+1 =0&&vis[a[i-1][j]]==0){ vis[a[i-1][j]]=1; dfs(i-1,j,len+1); vis[a[i-1][j]]=0; } if(j+1 =0&&vis[a[i][j-1]]==0){ vis[a[i][j-1]]=1; dfs(i,j-1,len+1); vis[a[i][j-1]]=0; } } int main() { scanf("%d%d",&r,&s); for(int i=0;i